19 * @param array $args Optional. Arguments to pass to the class. Accepts 'screen'. |
19 * @param array $args Optional. Arguments to pass to the class. Accepts 'screen'. |
20 * @return WP_List_Table|bool List table object on success, false if the class does not exist. |
20 * @return WP_List_Table|bool List table object on success, false if the class does not exist. |
21 */ |
21 */ |
22 function _get_list_table( $class, $args = array() ) { |
22 function _get_list_table( $class, $args = array() ) { |
23 $core_classes = array( |
23 $core_classes = array( |
24 //Site Admin |
24 // Site Admin. |
25 'WP_Posts_List_Table' => 'posts', |
25 'WP_Posts_List_Table' => 'posts', |
26 'WP_Media_List_Table' => 'media', |
26 'WP_Media_List_Table' => 'media', |
27 'WP_Terms_List_Table' => 'terms', |
27 'WP_Terms_List_Table' => 'terms', |
28 'WP_Users_List_Table' => 'users', |
28 'WP_Users_List_Table' => 'users', |
29 'WP_Comments_List_Table' => 'comments', |
29 'WP_Comments_List_Table' => 'comments', |
30 'WP_Post_Comments_List_Table' => array( 'comments', 'post-comments' ), |
30 'WP_Post_Comments_List_Table' => array( 'comments', 'post-comments' ), |
31 'WP_Links_List_Table' => 'links', |
31 'WP_Links_List_Table' => 'links', |
32 'WP_Plugin_Install_List_Table' => 'plugin-install', |
32 'WP_Plugin_Install_List_Table' => 'plugin-install', |
33 'WP_Themes_List_Table' => 'themes', |
33 'WP_Themes_List_Table' => 'themes', |
34 'WP_Theme_Install_List_Table' => array( 'themes', 'theme-install' ), |
34 'WP_Theme_Install_List_Table' => array( 'themes', 'theme-install' ), |
35 'WP_Plugins_List_Table' => 'plugins', |
35 'WP_Plugins_List_Table' => 'plugins', |
36 // Network Admin |
36 |
37 'WP_MS_Sites_List_Table' => 'ms-sites', |
37 // Network Admin. |
38 'WP_MS_Users_List_Table' => 'ms-users', |
38 'WP_MS_Sites_List_Table' => 'ms-sites', |
39 'WP_MS_Themes_List_Table' => 'ms-themes', |
39 'WP_MS_Users_List_Table' => 'ms-users', |
|
40 'WP_MS_Themes_List_Table' => 'ms-themes', |
|
41 |
|
42 // Privacy requests tables. |
|
43 'WP_Privacy_Data_Export_Requests_List_Table' => 'privacy-data-export-requests', |
|
44 'WP_Privacy_Data_Removal_Requests_List_Table' => 'privacy-data-removal-requests', |
40 ); |
45 ); |
41 |
46 |
42 if ( isset( $core_classes[ $class ] ) ) { |
47 if ( isset( $core_classes[ $class ] ) ) { |
43 foreach ( (array) $core_classes[ $class ] as $required ) { |
48 foreach ( (array) $core_classes[ $class ] as $required ) { |
44 require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php' ); |
49 require_once ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php'; |
45 } |
50 } |
46 |
51 |
47 if ( isset( $args['screen'] ) ) { |
52 if ( isset( $args['screen'] ) ) { |
48 $args['screen'] = convert_to_screen( $args['screen'] ); |
53 $args['screen'] = convert_to_screen( $args['screen'] ); |
49 } elseif ( isset( $GLOBALS['hook_suffix'] ) ) { |
54 } elseif ( isset( $GLOBALS['hook_suffix'] ) ) { |
59 } |
64 } |
60 |
65 |
61 /** |
66 /** |
62 * Register column headers for a particular screen. |
67 * Register column headers for a particular screen. |
63 * |
68 * |
|
69 * @see get_column_headers(), print_column_headers(), get_hidden_columns() |
|
70 * |
64 * @since 2.7.0 |
71 * @since 2.7.0 |
65 * |
72 * |
66 * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions. |
73 * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the |
67 * @param array $columns An array of columns with column IDs as the keys and translated column names as the values |
74 * add_*_page() functions. |
68 * @see get_column_headers(), print_column_headers(), get_hidden_columns() |
75 * @param string[] $columns An array of columns with column IDs as the keys and translated column names as the values. |
69 */ |
76 */ |
70 function register_column_headers( $screen, $columns ) { |
77 function register_column_headers( $screen, $columns ) { |
71 new _WP_List_Table_Compat( $screen, $columns ); |
78 new _WP_List_Table_Compat( $screen, $columns ); |
72 } |
79 } |
73 |
80 |