equal
deleted
inserted
replaced
6 * @subpackage List_Table |
6 * @subpackage List_Table |
7 * @since 4.7.0 |
7 * @since 4.7.0 |
8 */ |
8 */ |
9 |
9 |
10 /** |
10 /** |
11 * Helper class to be used only by back compat functions |
11 * Helper class to be used only by back compat functions. |
12 * |
12 * |
13 * @since 3.1.0 |
13 * @since 3.1.0 |
14 */ |
14 */ |
15 class _WP_List_Table_Compat extends WP_List_Table { |
15 class _WP_List_Table_Compat extends WP_List_Table { |
16 public $_screen; |
16 public $_screen; |
17 public $_columns; |
17 public $_columns; |
18 |
18 |
|
19 /** |
|
20 * Constructor. |
|
21 * |
|
22 * @since 3.1.0 |
|
23 * |
|
24 * @param string|WP_Screen $screen The screen hook name or screen object. |
|
25 * @param string[] $columns An array of columns with column IDs as the keys |
|
26 * and translated column names as the values. |
|
27 */ |
19 public function __construct( $screen, $columns = array() ) { |
28 public function __construct( $screen, $columns = array() ) { |
20 if ( is_string( $screen ) ) { |
29 if ( is_string( $screen ) ) { |
21 $screen = convert_to_screen( $screen ); |
30 $screen = convert_to_screen( $screen ); |
22 } |
31 } |
23 |
32 |
28 add_filter( 'manage_' . $screen->id . '_columns', array( $this, 'get_columns' ), 0 ); |
37 add_filter( 'manage_' . $screen->id . '_columns', array( $this, 'get_columns' ), 0 ); |
29 } |
38 } |
30 } |
39 } |
31 |
40 |
32 /** |
41 /** |
|
42 * Gets a list of all, hidden, and sortable columns. |
|
43 * |
|
44 * @since 3.1.0 |
|
45 * |
33 * @return array |
46 * @return array |
34 */ |
47 */ |
35 protected function get_column_info() { |
48 protected function get_column_info() { |
36 $columns = get_column_headers( $this->_screen ); |
49 $columns = get_column_headers( $this->_screen ); |
37 $hidden = get_hidden_columns( $this->_screen ); |
50 $hidden = get_hidden_columns( $this->_screen ); |
40 |
53 |
41 return array( $columns, $hidden, $sortable, $primary ); |
54 return array( $columns, $hidden, $sortable, $primary ); |
42 } |
55 } |
43 |
56 |
44 /** |
57 /** |
|
58 * Gets a list of columns. |
|
59 * |
|
60 * @since 3.1.0 |
|
61 * |
45 * @return array |
62 * @return array |
46 */ |
63 */ |
47 public function get_columns() { |
64 public function get_columns() { |
48 return $this->_columns; |
65 return $this->_columns; |
49 } |
66 } |