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.
Built from https://develop.svn.wordpress.org/trunk@48423


git-svn-id: http://core.svn.wordpress.org/trunk@48192 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-07-10 16:02:05 +00:00
parent 7d0162bc2e
commit 0f92086ca0
2 changed files with 7 additions and 8 deletions

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
/**

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-beta1-48422';
$wp_version = '5.5-beta1-48423';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.