Skip to content

Commit 6933d2d

Browse files
committed
Closes #26: new configuration filter: acm_ad_code_args, readme updates, make sure google-adsense conforms to new way
1 parent 377a7aa commit 6933d2d

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

common/lib/acm-provider.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ function __construct() {
2929
'editable' => true,
3030
'required' => true,
3131
),
32-
);
33-
$this->ad_code_args = apply_filters( 'acm_ad_code_args', $this->ad_code_args );
32+
);
3433
}
34+
/**
35+
* Configuration filter: acm_ad_code_args
36+
*/
37+
$this->ad_code_args = apply_filters( 'acm_ad_code_args', $this->ad_code_args );
3538

3639
// Could be filtered via acm_output_html filter
3740
// @see Ad_Code_Manager::action_acm_tag()

providers/google-adsense.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@ public function __construct() {
3838
//Since URLs aren't used with AdSense, value 'null' is included as ACM uses parse_url to validate URLs
3939
$this->whitelisted_script_urls = array( '%slot%', null );
4040

41-
//Specify table columns
42-
$this->columns = apply_filters( 'acm_provider_columns', array( 'slot' => 'Slot' ) );
41+
$this->ad_code_args = array(
42+
array(
43+
'key' => 'slot',
44+
'label' => __( 'Slot', 'ad-code-manager' ),
45+
'editable' => true,
46+
'required' => true,
47+
),
48+
);
4349

4450
parent::__construct();
4551
}

readme.txt

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,19 +268,24 @@ Example usage:
268268
return $columns;
269269
}`
270270

271-
= acm_provider_columns =
271+
= acm_acm_ad_code_args =
272272

273273
This filter comes in pair with previous one, it should return array of ad network specific parameters. E.g. in acm_list_table_columns example we have
274-
'id', 'name', 'priority', 'conditionals'. All of them except name are generic for Ad Code Manager. Hence acm_provider_columns should return only "name"
274+
'id', 'name', 'priority', 'conditionals'. All of them except name are generic for Ad Code Manager. Hence acm_provider_columns should return only "name". "editable" and "required" indicate whether this field should be editable and required.
275275

276276
Example usage:
277277

278-
`add_filter( 'acm_provider_columns', 'my_acm_provider_columns' );
279-
function my_acm_provider_columns( $columns ) {
280-
$columns = array(
281-
'name' => __( 'Name', 'ad-code-manager' ),
278+
`add_filter( 'acm_ad_code_args', 'my_acm_ad_code_args' );
279+
function my_acm_ad_code_args( $args ) {
280+
$args = array(
281+
array(
282+
'key' => 'name',
283+
'label' => __( 'Name', 'ad-code-manager' ),
284+
'editable' => true,
285+
'required' => true,
286+
),
282287
);
283-
return $columns;
288+
return $args;
284289
}`
285290

286291
== Screenshots ==

0 commit comments

Comments
 (0)