Docs: Improve compatibility comment in `WP_List_Table`.

Improve comment explaining backward compatibility check for the primary column in `WP_List_Table::get_column_info()`.

Unprops helen, markjaquith.
See #52628, #34564.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2021-03-09 22:35:06 +00:00
parent ebee7d0ab9
commit fb1857def8
2 changed files with 8 additions and 3 deletions

View File

@ -1111,8 +1111,13 @@ class WP_List_Table {
protected function get_column_info() { protected function get_column_info() {
// $_column_headers is already set / cached. // $_column_headers is already set / cached.
if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) { if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) {
// Back-compat for list tables that have been manually setting $_column_headers for horse reasons. /*
// In 4.3, we added a fourth argument for primary column. * Backward compatibility for `$_column_headers` format prior to WordPress 4.3.
*
* In WordPress 4.3 the primary column name was added as a forth item in the
* column headers property. This ensures the primary column name is included
* in plugins setting the property directly in the three item format.
*/
$column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); $column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
foreach ( $this->_column_headers as $key => $value ) { foreach ( $this->_column_headers as $key => $value ) {
$column_headers[ $key ] = $value; $column_headers[ $key ] = $value;

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.8-alpha-50512'; $wp_version = '5.8-alpha-50516';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.