mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
List tables: Add a fallback for the primary column.
Without a primary column defined, nothing shows in the responsive view at all, which is bad. props mordauk. see #25408. Built from https://develop.svn.wordpress.org/trunk@33104 git-svn-id: http://core.svn.wordpress.org/trunk@33075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ffb1de37ae
commit
81c2f541b0
@ -832,7 +832,21 @@ class WP_List_Table {
|
||||
* @return string Name of the default primary column, in this case, an empty string.
|
||||
*/
|
||||
protected function get_default_primary_column_name() {
|
||||
return '';
|
||||
$columns = $this->get_columns();
|
||||
$column = '';
|
||||
|
||||
// We need a primary defined so responsive views show something,
|
||||
// so let's fall back to the first non-checkbox column.
|
||||
foreach( $columns as $col => $column_name ) {
|
||||
if ( 'cb' === $col ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$column = $col;
|
||||
break;
|
||||
}
|
||||
|
||||
return $column;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -878,7 +892,7 @@ class WP_List_Table {
|
||||
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.
|
||||
$column_headers = array( array(), array(), array(), '' );
|
||||
$column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
|
||||
foreach ( $this->_column_headers as $key => $value ) {
|
||||
$column_headers[ $key ] = $value;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.3-beta1-33103';
|
||||
$wp_version = '4.3-beta1-33104';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user