diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php
index e3678b60d5..19fc44690f 100644
a
|
b
|
class WP_Comments_List_Table extends WP_List_Table { |
124 | 124 | $start += $_REQUEST['offset']; |
125 | 125 | } |
126 | 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' ); |
| 132 | } |
| 133 | |
127 | 134 | $status_map = array( |
128 | 135 | 'mine' => '', |
129 | 136 | 'moderated' => 'hold', |
… |
… |
class WP_Comments_List_Table extends WP_List_Table { |
751 | 758 | /** This filter is documented in wp-admin/includes/dashboard.php */ |
752 | 759 | $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); |
753 | 760 | |
| 761 | $always_visible = false; |
| 762 | $mode = get_user_setting( 'posts_list_mode', 'list' ); |
| 763 | if ( 'extended' === $mode ) { |
| 764 | $always_visible = true; |
| 765 | } |
| 766 | |
754 | 767 | $i = 0; |
755 | | $out .= '<div class="row-actions">'; |
| 768 | $out .= '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
756 | 769 | foreach ( $actions as $action => $link ) { |
757 | 770 | ++$i; |
758 | 771 | ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; |
diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php
index 791ee7c159..7736652ce4 100644
a
|
b
|
class WP_List_Table { |
166 | 166 | |
167 | 167 | if ( empty( $this->modes ) ) { |
168 | 168 | $this->modes = array( |
169 | | 'list' => __( 'List View' ), |
170 | | 'excerpt' => __( 'Excerpt View' ), |
| 169 | 'list' => __( 'Compact view' ), |
| 170 | 'extended' => __( 'Extended view' ), |
171 | 171 | ); |
172 | 172 | } |
173 | 173 | } |
… |
… |
class WP_List_Table { |
517 | 517 | return ''; |
518 | 518 | } |
519 | 519 | |
| 520 | $mode = get_user_setting( 'posts_list_mode', 'list' ); |
| 521 | if ( 'extended' === $mode ) { |
| 522 | $always_visible = true; |
| 523 | } |
| 524 | |
520 | 525 | $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
521 | 526 | foreach ( $actions as $action => $link ) { |
522 | 527 | ++$i; |
diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php
index 3b29dce7d2..e2132fdb7b 100644
a
|
b
|
class WP_Posts_List_Table extends WP_List_Table { |
178 | 178 | } |
179 | 179 | |
180 | 180 | if ( ! empty( $_REQUEST['mode'] ) ) { |
181 | | $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; |
| 181 | $mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list'; |
182 | 182 | set_user_setting( 'posts_list_mode', $mode ); |
183 | 183 | } else { |
184 | 184 | $mode = get_user_setting( 'posts_list_mode', 'list' ); |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
1040 | 1040 | } |
1041 | 1041 | echo "</strong>\n"; |
1042 | 1042 | |
1043 | | if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'excerpt' === $mode && current_user_can( 'read_post', $post->ID ) ) { |
| 1043 | if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'extended' === $mode && current_user_can( 'read_post', $post->ID ) ) { |
1044 | 1044 | if ( post_password_required( $post ) ) { |
1045 | 1045 | echo '<span class="protected-post-excerpt">' . esc_html( get_the_excerpt() ) . '</span>'; |
1046 | 1046 | } else { |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
1100 | 1100 | * @param string $status The status text. |
1101 | 1101 | * @param WP_Post $post Post object. |
1102 | 1102 | * @param string $column_name The column name. |
1103 | | * @param string $mode The list display mode ('excerpt' or 'list'). |
| 1103 | * @param string $mode The list display mode ('extended' or 'list'). |
1104 | 1104 | */ |
1105 | 1105 | $status = apply_filters( 'post_date_column_status', $status, $post, 'date', $mode ); |
1106 | 1106 | |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
1108 | 1108 | echo $status . '<br />'; |
1109 | 1109 | } |
1110 | 1110 | |
1111 | | if ( 'excerpt' === $mode ) { |
| 1111 | if ( 'extended' === $mode || 'excerpt' === $mode ) { |
1112 | 1112 | /** |
1113 | 1113 | * Filters the published time of the post. |
1114 | 1114 | * |
1115 | | * If `$mode` equals 'excerpt', the published time and date are both displayed. |
| 1115 | * If `$mode` equals 'extended', the published time and date are both displayed. |
1116 | 1116 | * If `$mode` equals 'list' (default), the publish date is displayed, with the |
1117 | 1117 | * time and date together available as an abbreviation definition. |
1118 | 1118 | * |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
1121 | 1121 | * @param string $t_time The published time. |
1122 | 1122 | * @param WP_Post $post Post object. |
1123 | 1123 | * @param string $column_name The column name. |
1124 | | * @param string $mode The list display mode ('excerpt' or 'list'). |
| 1124 | * @param string $mode The list display mode ('extended' or 'list'). |
1125 | 1125 | */ |
1126 | 1126 | echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode ); |
1127 | 1127 | } else { |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
1456 | 1456 | * |
1457 | 1457 | * @since 3.1.0 |
1458 | 1458 | * |
1459 | | * @global string $mode List table view mode. |
| 1459 | * @global string $mode Compact table view mode. |
1460 | 1460 | */ |
1461 | 1461 | public function inline_edit() { |
1462 | 1462 | global $mode; |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
1496 | 1496 | } |
1497 | 1497 | } |
1498 | 1498 | |
1499 | | $m = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list'; |
| 1499 | $m = ( isset( $mode ) && 'extended' === $mode ) ? 'extended' : 'list'; |
1500 | 1500 | $can_publish = current_user_can( $post_type_object->cap->publish_posts ); |
1501 | 1501 | $core_columns = array( |
1502 | 1502 | 'cb' => true, |
diff --git a/src/wp-admin/includes/class-wp-screen.php b/src/wp-admin/includes/class-wp-screen.php
index e3a2fcd7a6..0f86425218 100644
a
|
b
|
final class WP_Screen { |
1288 | 1288 | public function render_view_mode() { |
1289 | 1289 | $screen = get_current_screen(); |
1290 | 1290 | |
1291 | | // Currently only enabled for posts lists. |
1292 | | if ( 'edit' !== $screen->base ) { |
| 1291 | // Currently only enabled for posts and comments lists. |
| 1292 | if ( 'edit' !== $screen->base && 'edit-comments' !== $screen->base && 'users' !== $screen->base ) { |
1293 | 1293 | return; |
1294 | 1294 | } |
1295 | 1295 | |
1296 | | $view_mode_post_types = get_post_types( |
1297 | | array( |
1298 | | 'hierarchical' => false, |
1299 | | 'show_ui' => true, |
1300 | | ) |
1301 | | ); |
| 1296 | $view_mode_post_types = get_post_types( array( 'show_ui' => true ) ); |
1302 | 1297 | |
1303 | 1298 | /** |
1304 | 1299 | * Filters the post types that have different view mode options. |
… |
… |
final class WP_Screen { |
1306 | 1301 | * @since 4.4.0 |
1307 | 1302 | * |
1308 | 1303 | * @param string[] $view_mode_post_types Array of post types that can change view modes. |
1309 | | * Default non-hierarchical post types with show_ui on. |
| 1304 | * Default post types with show_ui on. |
1310 | 1305 | */ |
1311 | 1306 | $view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types ); |
1312 | 1307 | |
1313 | | if ( ! in_array( $this->post_type, $view_mode_post_types, true ) ) { |
| 1308 | if ( 'edit' === $screen->base && ! in_array( $this->post_type, $view_mode_post_types, true ) ) { |
1314 | 1309 | return; |
1315 | 1310 | } |
1316 | 1311 | |
1317 | | global $mode; |
| 1312 | $mode = get_user_setting( 'posts_list_mode', 'list' ); |
| 1313 | |
| 1314 | // Set 'list' as default value if $mode is not set. |
| 1315 | $mode = ( isset( $mode ) && 'extended' === $mode ) ? 'extended' : 'list'; |
1318 | 1316 | |
1319 | 1317 | // This needs a submit button. |
1320 | 1318 | add_filter( 'screen_options_show_submit', '__return_true' ); |
… |
… |
final class WP_Screen { |
1323 | 1321 | <legend><?php _e( 'View Mode' ); ?></legend> |
1324 | 1322 | <label for="list-view-mode"> |
1325 | 1323 | <input id="list-view-mode" type="radio" name="mode" value="list" <?php checked( 'list', $mode ); ?> /> |
1326 | | <?php _e( 'List View' ); ?> |
| 1324 | <?php _e( 'Compact view' ); ?> |
1327 | 1325 | </label> |
1328 | 1326 | <label for="excerpt-view-mode"> |
1329 | | <input id="excerpt-view-mode" type="radio" name="mode" value="excerpt" <?php checked( 'excerpt', $mode ); ?> /> |
1330 | | <?php _e( 'Excerpt View' ); ?> |
| 1327 | <input id="excerpt-view-mode" type="radio" name="mode" value="extended" <?php checked( 'extended', $mode ); ?> /> |
| 1328 | <?php _e( 'Extended View' ); ?> |
1331 | 1329 | </label> |
1332 | 1330 | </fieldset> |
1333 | 1331 | <?php |
diff --git a/src/wp-admin/includes/class-wp-users-list-table.php b/src/wp-admin/includes/class-wp-users-list-table.php
index 018654bdd2..731e9304e5 100644
a
|
b
|
class WP_Users_List_Table extends WP_List_Table { |
127 | 127 | $args['order'] = $_REQUEST['order']; |
128 | 128 | } |
129 | 129 | |
| 130 | if ( ! empty( $_REQUEST['mode'] ) ) { |
| 131 | $mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list'; |
| 132 | set_user_setting( 'posts_list_mode', $mode ); |
| 133 | } else { |
| 134 | $mode = get_user_setting( 'posts_list_mode', 'list' ); |
| 135 | } |
| 136 | |
130 | 137 | /** |
131 | 138 | * Filters the query arguments used to retrieve users for the current users list table. |
132 | 139 | * |