Skip to content

Commit a94917b

Browse files
Merge branch 'develop' of github.com:Automattic/Ad-Code-Manager
2 parents 628a544 + 342131c commit a94917b

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

ad-code-manager.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ function action_load_providers() {
115115

116116
}
117117

118+
/**
119+
* Configuration filter: acm_register_provider_slug
120+
*
121+
* We've already gathered a list of default providers by scanning the ACM plugin
122+
* directory for classes that we can use. To add a provider already included via
123+
* a different directory, the following filter is provided.
124+
*/
125+
$this->providers = apply_filters( 'acm_register_provider_slug', $this->providers );
126+
118127
/**
119128
* Configuration filter: acm_provider_slug
120129
*

readme.txt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ function my_acm_ad_tag_ids( $tag_ids ) {
5454
'sz' => '728x90', // %sz% token
5555
'fold' => 'atf', // %fold% token
5656
'my_custom_token' => 'something' // %my_custom_token% will be replaced with 'something'
57-
);
57+
),
58+
);
5859
return $tag_ids;
5960
}`
6061

@@ -101,6 +102,26 @@ function my_acm_output_html( $output_html, $tag_id ) {
101102
return $output_html;
102103
}`
103104

105+
= acm_register_provider_slug =
106+
107+
Ad Code Manager has a built in list of providers that it gathers by scanning the 'providers' directory used by the plugin. Additional providers can be added by placing the appropriate files in that directory, or by using the `acm_register_provider_slug` filter to register those that may be included as part of your theme or another plugin.
108+
109+
When using this plugin, you are defining the provider slug as part of the existing object as well as an array of classes associated with that provider slug.
110+
111+
Arguments:
112+
* object $providers An object containing the current registered providers.
113+
114+
Example usage:
115+
116+
`add_filter( 'acm_register_provider_slug', 'my_acm_register_provider_slug' );
117+
function my_acm_register_provider_slug( $providers ) {
118+
$providers->new_provider_slug = array(
119+
'provider' => 'My_New_Ad_Company_ACM_Provider',
120+
'table' => 'My_New_Ad_Company_ACM_WP_List_Table'
121+
);
122+
return $providers;
123+
}`
124+
104125
= acm_whitelisted_script_urls =
105126

106127
A security filter to whitelist which ad code script URLs can be added in the admin

0 commit comments

Comments
 (0)