mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@48398 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -178,7 +178,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
}
|
||||
|
||||
if ( ! empty( $_REQUEST['mode'] ) ) {
|
||||
$mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';
|
||||
$mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list';
|
||||
set_user_setting( 'posts_list_mode', $mode );
|
||||
} else {
|
||||
$mode = get_user_setting( 'posts_list_mode', 'list' );
|
||||
@@ -598,7 +598,22 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
* @return array
|
||||
*/
|
||||
protected function get_table_classes() {
|
||||
return array( 'widefat', 'fixed', 'striped', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
|
||||
$mode = get_user_setting( 'posts_list_mode', 'list' );
|
||||
$mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-list';
|
||||
$mode = get_user_setting( 'posts_list_mode', 'list' );
|
||||
/**
|
||||
* Filters the current view mode.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param string $mode The current selected mode. Default value of
|
||||
* posts_list_mode user setting.
|
||||
*/
|
||||
$mode = apply_filters( 'table_view_mode', $mode );
|
||||
|
||||
$mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-' . $mode;
|
||||
|
||||
return array( 'widefat', 'fixed', 'striped', $mode_class, is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1042,7 +1057,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
}
|
||||
echo "</strong>\n";
|
||||
|
||||
if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'excerpt' === $mode && current_user_can( 'read_post', $post->ID ) ) {
|
||||
if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'extended' === $mode && current_user_can( 'read_post', $post->ID ) ) {
|
||||
if ( post_password_required( $post ) ) {
|
||||
echo '<span class="protected-post-excerpt">' . esc_html( get_the_excerpt() ) . '</span>';
|
||||
} else {
|
||||
@@ -1102,7 +1117,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
* @param string $status The status text.
|
||||
* @param WP_Post $post Post object.
|
||||
* @param string $column_name The column name.
|
||||
* @param string $mode The list display mode ('excerpt' or 'list').
|
||||
* @param string $mode The list display mode ('extended' or 'list').
|
||||
*/
|
||||
$status = apply_filters( 'post_date_column_status', $status, $post, 'date', $mode );
|
||||
|
||||
@@ -1121,7 +1136,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
* @param string $t_time The published time.
|
||||
* @param WP_Post $post Post object.
|
||||
* @param string $column_name The column name.
|
||||
* @param string $mode The list display mode ('excerpt' or 'list').
|
||||
* @param string $mode The list display mode ('extended' or 'list').
|
||||
*/
|
||||
echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode );
|
||||
}
|
||||
@@ -1491,7 +1506,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
}
|
||||
}
|
||||
|
||||
$m = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list';
|
||||
$m = ( isset( $mode ) && 'extended' === $mode ) ? 'extended' : 'list';
|
||||
$can_publish = current_user_can( $post_type_object->cap->publish_posts );
|
||||
$core_columns = array(
|
||||
'cb' => true,
|
||||
|
||||
Reference in New Issue
Block a user