Administration: Remove private delegation from list tables.

Remove the private delegation from the following classes and function:

* `WP_List_Table`
* `WP_Application_Passwords_List_Table`
* `WP_Comments_List_Table`
* `WP_Links_List_Table`
* `WP_Media_List_Table`
* `WP_MS_Sites_List_Table`
* `WP_MS_Themes_List_Table`
* `WP_MS_Users_List_Table`
* `WP_Plugin_Install_List_Table`
* `WP_Plugins_List_Table`
* `WP_Post_Comments_List_Table`
* `WP_Posts_List_Table`
* `WP_Terms_List_Table`
* `WP_Theme_Install_List_Table`
* `WP_Themes_List_Table`
* `WP_Users_List_Table`
* `_get_list_table()`

This change is to reflect the reality that list tables are very, very, very widely used by extenders and backward compatibility therefore needs to be maintained.

Introduces the filter `wp_list_table_class_name` within `_get_list_table()` to allow extenders to modify the list table returned for custom screens.

Props audrasjb, birgire, costdev, desrosj, faison, johnbillion, jrbeilke, kurtpayne, milana_cap, miqrogroove, nacin, peterwilsoncc, scribu, sergeybiryukov, sirzooro, westonruter, wonderboymusic.
Fixes #18449.

Built from https://develop.svn.wordpress.org/trunk@54378


git-svn-id: http://core.svn.wordpress.org/trunk@53937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2022-10-04 03:47:15 +00:00
parent 336517fab3
commit 566caa07ae
18 changed files with 15 additions and 18 deletions

View File

@ -11,7 +11,6 @@
* Class for displaying the list of application password items.
*
* @since 5.6.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying comments in a list table.
*
* @since 3.1.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying links in a list table.
*
* @since 3.1.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -11,7 +11,6 @@
* Base class for displaying a list of items in an ajaxified HTML table.
*
* @since 3.1.0
* @access private
*/
#[AllowDynamicProperties]
class WP_List_Table {

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying media items in a list table.
*
* @since 3.1.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying sites in a list table for the network admin.
*
* @since 3.1.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying themes in a list table for the network admin.
*
* @since 3.1.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying users in a list table for the network admin.
*
* @since 3.1.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying plugins to install in a list table.
*
* @since 3.1.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying installed plugins in a list table.
*
* @since 3.1.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying post comments in a list table.
*
* @since 3.1.0
* @access private
*
* @see WP_Comments_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying posts in a list table.
*
* @since 3.1.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying terms in a list table.
*
* @since 3.1.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying themes to install in a list table.
*
* @since 3.1.0
* @access private
*
* @see WP_Themes_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying installed themes in a list table.
*
* @since 3.1.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -11,7 +11,6 @@
* Core class used to implement displaying users in a list table.
*
* @since 3.1.0
* @access private
*
* @see WP_List_Table
*/

View File

@ -10,7 +10,6 @@
/**
* Fetches an instance of a WP_List_Table class.
*
* @access private
* @since 3.1.0
*
* @global string $hook_suffix
@ -58,6 +57,20 @@ function _get_list_table( $class_name, $args = array() ) {
$args['screen'] = null;
}
/**
* Filters the list table class to instantiate.
*
* @since 6.1.0
*
* @param string $class_name The list table class to use.
* @param array $args An array containing _get_list_table() arguments.
*/
$custom_class_name = apply_filters( 'wp_list_table_class_name', $class_name, $args );
if ( is_string( $custom_class_name ) && class_exists( $custom_class_name ) ) {
$class_name = $custom_class_name;
}
return new $class_name( $args );
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-beta2-54377';
$wp_version = '6.1-beta2-54378';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.