Make WordPress Core

Changeset 32722


Ignore:
Timestamp:
06/10/2015 02:58:42 PM (10 years ago)
Author:
helen
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-list-table.php

    r32717 r32722  
    851851     */
    852852    protected function get_column_info() {
    853         if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) && count( $this->_column_headers ) >= 4 ) {
    854             return $this->_column_headers;
     853        // $_column_headers is already set / cached
     854        if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) {
     855            // Back-compat for list tables that have been manually setting $_column_headers for horse reasons.
     856            // In 4.3, we added a fourth argument for primary column.
     857            $column_headers = array( array(), array(), array(), '' );
     858            foreach ( $this->_column_headers as $key => $value ) {
     859                $column_headers[ $key ] = $value;
     860            }
     861
     862            return $column_headers;
    855863        }
    856864
Note: See TracChangeset for help on using the changeset viewer.