Make WordPress Core


Ignore:
Timestamp:
07/07/2020 07:10:46 PM (6 years 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-comments-list-table.php

    r48352 r48398  
    123123                if ( $doing_ajax && isset( $_REQUEST['offset'] ) ) {
    124124                        $start += $_REQUEST['offset'];
     125                }
     126
     127                if ( ! empty( $_REQUEST['mode'] ) ) {
     128                        $mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list';
     129                        set_user_setting( 'posts_list_mode', $mode );
     130                } else {
     131                        $mode = get_user_setting( 'posts_list_mode', 'list' );
    125132                }
    126133
     
    752759                $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
    753760
     761                $always_visible = false;
     762                $mode = get_user_setting( 'posts_list_mode', 'list' );
     763                if ( 'extended' === $mode ) {
     764                        $always_visible = true;
     765                }
     766
    754767                $i    = 0;
    755                 $out .= '<div class="row-actions">';
     768                $out .= '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
    756769                foreach ( $actions as $action => $link ) {
    757770                        ++$i;
Note: See TracChangeset for help on using the changeset viewer.