WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/07/2020 07:10:46 PM (15 months ago)
Author:
whyisjake
Message:

Administration: Introduce extensibility to posts and comments list table views, for accessibility purposes.

At default, expands the excerpt view to become an extended view. Includes a new table_view_mode filter to allow further configuration.

Fixes #49715.
Props joedolson, audrasjb, afercia, whyisjake.

File:
1 edited

Legend:

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

    r48352 r48398  
    167167        if ( empty( $this->modes ) ) {
    168168            $this->modes = array(
    169                 'list'    => __( 'List View' ),
    170                 'excerpt' => __( 'Excerpt View' ),
     169                'list'     => __( 'Compact View' ),
     170                'extended' => __( 'Extended View' ),
    171171            );
    172172        }
     
    522522        if ( ! $action_count ) {
    523523            return '';
     524        }
     525
     526        $mode = get_user_setting( 'posts_list_mode', 'list' );
     527        if ( 'extended' === $mode ) {
     528            $always_visible = true;
    524529        }
    525530
     
    12481253     */
    12491254    protected function get_table_classes() {
    1250         return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] );
     1255        $mode       = get_user_setting( 'posts_list_mode', 'list' );
     1256        $mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-list';
     1257        $mode = get_user_setting( 'posts_list_mode', 'list' );
     1258        /**
     1259         * Filters the current view mode.
     1260         *
     1261         * @since 5.5.0
     1262         *
     1263         * @param string $mode The current selected mode. Default value of
     1264         *                     posts_list_mode user setting.
     1265         */
     1266        $mode = apply_filters( 'table_view_mode', $mode );
     1267
     1268        $mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-' . $mode;
     1269
     1270        return array( 'widefat', 'fixed', 'striped', $mode_class, $this->_args['plural'] );
    12511271    }
    12521272
Note: See TracChangeset for help on using the changeset viewer.