Make WordPress Core


Ignore:
Timestamp:
11/01/2014 07:55:26 PM (11 years ago)
Author:
wonderboymusic
Message:

In WP_List_Table, add a property, $modes, to allow WP_Media_List_Table to inherit ->view_switcher().

See #30224.

File:
1 edited

Legend:

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

    r30105 r30154  
    6464     */
    6565    private $_pagination;
     66
     67    /**
     68     * The view switcher modes
     69     *
     70     * @since 4.1.0
     71     * @var array
     72     * @access protected
     73     */
     74    protected $modes = array();
    6675
    6776    /**
     
    114123            // wp_enqueue_script( 'list-table' );
    115124            add_action( 'admin_footer', array( $this, '_js_vars' ) );
     125        }
     126
     127        if ( empty( $this->modes ) ) {
     128            $this->modes = array(
     129                'list'    => __( 'List View' ),
     130                'excerpt' => __( 'Excerpt View' )
     131            );
    116132        }
    117133    }
     
    521537     */
    522538    protected function view_switcher( $current_mode ) {
    523         $modes = array(
    524             'list'    => __( 'List View' ),
    525             'excerpt' => __( 'Excerpt View' )
    526         );
    527 
    528539?>
    529540        <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
    530541        <div class="view-switch">
    531542<?php
    532             foreach ( $modes as $mode => $title ) {
     543            foreach ( $this->modes as $mode => $title ) {
    533544                $classes = array( 'view-' . $mode );
    534545                if ( $current_mode == $mode )
Note: See TracChangeset for help on using the changeset viewer.