File tree Expand file tree Collapse file tree 4 files changed +36
-18
lines changed
Expand file tree Collapse file tree 4 files changed +36
-18
lines changed Original file line number Diff line number Diff line change @@ -24,16 +24,15 @@ function __construct( $params = array() ) {
2424 *
2525 * @return array $columns, the array of columns to use with the table
2626 */
27- function get_columns ( $ columns = false ) {
28- $ default = array (
27+ function get_columns () {
28+ $ columns = apply_filters ( ' acm_list_table_columns ' , array (
2929 'cb ' => '<input type="checkbox" /> ' ,
3030 'id ' => __ ( 'ID ' , 'ad-code-manager ' ),
3131 'name ' => __ ( 'Name ' , 'ad-code-manager ' ),
3232 'priority ' => __ ( 'Priority ' , 'ad-code-manager ' ),
3333 'operator ' => __ ( 'Logical Operator ' , 'ad-code-manager ' ),
3434 'conditionals ' => __ ( 'Conditionals ' , 'ad-code-manager ' ),
35- );
36- $ columns = apply_filters ( 'acm_list_table_columns ' , !is_array ( $ columns ) || empty ( $ columns ) ? $ default : $ columns );
35+ ) );
3736 // Fail-safe for misconfiguration
3837 $ required_before = array (
3938 'id ' => __ ( 'ID ' , 'ad-code-manager ' ),
Original file line number Diff line number Diff line change @@ -245,12 +245,11 @@ function __construct() {
245245 ) );
246246 }
247247
248-
249248 /**
250- * This is nuts and bolts of table representation
249+ * @return array The columns that shall be used
251250 */
252- function get_columns ( $ columns = null ) {
253- $ columns = array (
251+ function filter_columns ( ) {
252+ return array (
254253 'cb ' => '<input type="checkbox" /> ' ,
255254 'id ' => __ ( 'ID ' , 'ad-code-manager ' ),
256255 'tag ' => __ ( 'Tag ' , 'ad-code-manager ' ),
@@ -261,7 +260,14 @@ function get_columns( $columns = null ) {
261260 'operator ' => __ ( 'Logical Operator ' , 'ad-code-manager ' ),
262261 'conditionals ' => __ ( 'Conditionals ' , 'ad-code-manager ' ),
263262 );
264- return parent ::get_columns ( $ columns );
263+ }
264+
265+ /**
266+ * This is nuts and bolts of table representation
267+ */
268+ function get_columns () {
269+ add_filter ( 'acm_list_table_columns ' , array ( $ this , 'filter_columns ' ) );
270+ return parent ::get_columns ();
265271 }
266272
267273 /**
Original file line number Diff line number Diff line change @@ -93,12 +93,11 @@ function __construct() {
9393 ) );
9494 }
9595
96-
9796 /**
98- * This is nuts and bolts of table representation
97+ * @return array The columns that shall be used
9998 */
100- function get_columns ( $ columns = null ) {
101- $ columns = array (
99+ function filter_columns ( ) {
100+ return array (
102101 'cb ' => '<input type="checkbox" /> ' ,
103102 'id ' => __ ( 'ID ' , 'ad-code-manager ' ),
104103 'site_name ' => __ ( 'Site Name ' , 'ad-code-manager ' ),
@@ -107,7 +106,14 @@ function get_columns( $columns = null ) {
107106 'operator ' => __ ( 'Logical Operator ' , 'ad-code-manager ' ),
108107 'conditionals ' => __ ( 'Conditionals ' , 'ad-code-manager ' ),
109108 );
110- return parent ::get_columns ( $ columns );
109+ }
110+
111+ /**
112+ * This is nuts and bolts of table representation
113+ */
114+ function get_columns () {
115+ add_filter ( 'acm_list_table_columns ' , array ( $ this , 'filter_columns ' ) );
116+ return parent ::get_columns ();
111117 }
112118
113119 /**
Original file line number Diff line number Diff line change @@ -161,10 +161,10 @@ public function __construct() {
161161 }
162162
163163 /**
164- * This is nuts and bolts of table representation
164+ * @return array The columns that shall be used
165165 */
166- function get_columns ( $ columns = null ) {
167- $ columns = array (
166+ function filter_columns ( ) {
167+ return array (
168168 'cb ' => '<input type="checkbox" /> ' ,
169169 'id ' => __ ( 'ID ' , 'ad-code-manager ' ),
170170 'tag ' => __ ( 'Tag ' , 'ad-code-manager ' ),
@@ -174,7 +174,14 @@ function get_columns( $columns = null ) {
174174 'operator ' => __ ( 'Logical Operator ' , 'ad-code-manager ' ),
175175 'conditionals ' => __ ( 'Conditionals ' , 'ad-code-manager ' ),
176176 );
177- return parent ::get_columns ( $ columns );
177+ }
178+
179+ /**
180+ * This is nuts and bolts of table representation
181+ */
182+ function get_columns () {
183+ add_filter ( 'acm_list_table_columns ' , array ( $ this , 'filter_columns ' ) );
184+ return parent ::get_columns ();
178185 }
179186
180187 /**
You can’t perform that action at this time.
0 commit comments