List tables: Better primary column back-compat.

Why are people manually setting `$_column_headers` other than because somebody else told them to? Maybe time will tell.

props kovshenin.
see #25408.


git-svn-id: https://develop.svn.wordpress.org/trunk@32722 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Helen Hou-Sandi 2015-06-10 14:58:42 +00:00
parent 615ab22fea
commit 1a0773a4b4
1 changed files with 10 additions and 2 deletions

View File

@ -850,8 +850,16 @@ class WP_List_Table {
* @return array
*/
protected function get_column_info() {
if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) && count( $this->_column_headers ) >= 4 ) {
return $this->_column_headers;
// $_column_headers is already set / cached
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(), '' );
foreach ( $this->_column_headers as $key => $value ) {
$column_headers[ $key ] = $value;
}
return $column_headers;
}
$columns = get_column_headers( $this->screen );