Make WordPress Core


Ignore:
Timestamp:
09/24/2010 01:35:06 PM (13 years ago)
Author:
scribu
Message:

Column headers revamp:

  • undeprecate get_column_headers()
  • undeprecate get_hidden_columns()
  • in WP_List_Table, rename get_column_headers() to get_column_info()
  • remove $taxonomy argument from single_row()
  • merge manage_columns_prefs() into screen_meta()

Fixes #14952. Fixes #14776.

File:
1 edited

Legend:

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

    r15642 r15653  
    7070     */
    7171    function WP_List_Table( $args ) {
     72        global $_wp_column_headers;
     73
     74        $_wp_column_headers = $this->get_columns();
    7275
    7376        $args = wp_parse_args( $args, array(
     
    8285        if ( is_string( $this->_screen ) )
    8386            $this->_screen = convert_to_screen( $this->_screen );
     87
     88        add_filter( 'manage_' . $this->_screen->id . '_columns', array( $this, 'get_columns' ) );
    8489
    8590        if ( !$args['plural'] )
     
    515520
    516521    /**
    517      * Get a list of hidden columns.
    518      *
    519      * @since 3.1.0
    520      * @access private
     522     * Get a list of all, hidden and sortable columns, with filter applied
     523     *
     524     * @since 3.1.0
     525     * @access protected
    521526     *
    522527     * @return array
    523528     */
    524     function get_hidden_columns() {
    525         return (array) get_user_option( 'manage' . $this->_screen->id. 'columnshidden' );
    526     }
    527 
    528     /**
    529      * Get a list of all, hidden and sortable columns, with filter applied
    530      *
    531      * @since 3.1.0
    532      * @access protected
    533      *
    534      * @return array
    535      */
    536     function get_column_headers() {
     529    function get_column_info() {
    537530        if ( !isset( $this->_column_headers ) ) {
    538             $columns = apply_filters( 'manage_' . $this->_screen->id . '_columns', $this->get_columns() );
     531            $columns = get_column_headers( $this->_screen );
     532            $hidden = get_hidden_columns( $this->_screen );
    539533            $sortable = apply_filters( 'manage_' . $this->_screen->id . '_sortable_columns', $this->get_sortable_columns() );
    540             $hidden = $this->get_hidden_columns();
    541534
    542535            $this->_column_headers = array( $columns, $hidden, $sortable );
     
    557550        $screen = $this->_screen;
    558551
    559         list( $columns, $hidden, $sortable ) = $this->get_column_headers();
     552        list( $columns, $hidden, $sortable ) = $this->get_column_info();
    560553
    561554        $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     
    747740     */
    748741    function single_row_columns( $item ) {
    749         list( $columns, $hidden ) = $this->get_column_headers();
     742        list( $columns, $hidden ) = $this->get_column_info();
    750743
    751744        foreach ( $columns as $column_name => $column_display_name ) {
Note: See TracChangeset for help on using the changeset viewer.