mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Administration: Bring some consistency to handling list table view modes.
* Remove duplicate variables and DocBlocks. * Add missing description for the `$mode` global. * Use sentence case for "Compact view" and "Extended view" labels. Follow-up to [48398], [48423]. Props afercia, Offereins, SergeyBiryukov. See #49715. git-svn-id: https://develop.svn.wordpress.org/trunk@48424 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -135,13 +135,20 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
}
|
||||
|
||||
/**
|
||||
* @global string $mode List table view mode.
|
||||
* @global array $avail_post_stati
|
||||
* @global WP_Query $wp_query WordPress Query object.
|
||||
* @global int $per_page
|
||||
* @global string $mode
|
||||
*/
|
||||
public function prepare_items() {
|
||||
global $avail_post_stati, $wp_query, $per_page, $mode;
|
||||
global $mode, $avail_post_stati, $wp_query, $per_page;
|
||||
|
||||
if ( ! empty( $_REQUEST['mode'] ) ) {
|
||||
$mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list';
|
||||
set_user_setting( 'posts_list_mode', $mode );
|
||||
} else {
|
||||
$mode = get_user_setting( 'posts_list_mode', 'list' );
|
||||
}
|
||||
|
||||
// Is going to call wp().
|
||||
$avail_post_stati = wp_edit_posts_query();
|
||||
@@ -177,13 +184,6 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $_REQUEST['mode'] ) ) {
|
||||
$mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list';
|
||||
set_user_setting( 'posts_list_mode', $mode );
|
||||
} else {
|
||||
$mode = get_user_setting( 'posts_list_mode', 'list' );
|
||||
}
|
||||
|
||||
$this->is_trash = isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'];
|
||||
|
||||
$this->set_pagination_args(
|
||||
@@ -595,23 +595,17 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
}
|
||||
|
||||
/**
|
||||
* @global string $mode List table view mode.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_table_classes() {
|
||||
$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.
|
||||
*/
|
||||
global $mode;
|
||||
|
||||
/** This filter is documented in wp-admin/includes/class-wp-screen.php */
|
||||
$mode = apply_filters( 'table_view_mode', $mode );
|
||||
|
||||
$mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-' . $mode;
|
||||
$mode_class = esc_attr( 'table-view-' . $mode );
|
||||
|
||||
return array( 'widefat', 'fixed', 'striped', $mode_class, is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user