Administration: Make some adjustments to WP_Screen::render_view_mode():

* Restore the `$mode` global for backward compatibility.
* Remove redundant check, as `$mode` is already set at this point, and already defaults to `list` via `get_user_setting()`'s second argument.
* Use sentence case for "View mode" and "Extended view" labels.

Follow-up to [48398].

See #49715.

git-svn-id: https://develop.svn.wordpress.org/trunk@48423 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-07-10 16:00:42 +00:00
parent 4adb926ce8
commit 6c4f6693e5

View File

@ -1286,6 +1286,8 @@ final class WP_Screen {
* @global string $mode List table view mode.
*/
public function render_view_mode() {
global $mode;
$screen = get_current_screen();
// Currently only enabled for posts and comments lists.
@ -1311,16 +1313,13 @@ final class WP_Screen {
$mode = get_user_setting( 'posts_list_mode', 'list' );
// Set 'list' as default value if $mode is not set.
$mode = ( isset( $mode ) && 'extended' === $mode ) ? 'extended' : '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.
* @param string $mode The current selected mode. Defaults to the value
* of 'posts_list_mode' user setting.
*/
$mode = apply_filters( 'table_view_mode', $mode );
@ -1328,14 +1327,14 @@ final class WP_Screen {
add_filter( 'screen_options_show_submit', '__return_true' );
?>
<fieldset class="metabox-prefs view-mode">
<legend><?php _e( 'View Mode' ); ?></legend>
<legend><?php _e( 'View mode' ); ?></legend>
<label for="list-view-mode">
<input id="list-view-mode" type="radio" name="mode" value="list" <?php checked( 'list', $mode ); ?> />
<?php _e( 'Compact view' ); ?>
</label>
<label for="excerpt-view-mode">
<input id="excerpt-view-mode" type="radio" name="mode" value="extended" <?php checked( 'extended', $mode ); ?> />
<?php _e( 'Extended View' ); ?>
<?php _e( 'Extended view' ); ?>
</label>
<?php
/**