Make WordPress Core

Ticket #22222: 22222.patch

File 22222.patch, 4.5 KB (added by Oxymoron, 9 years ago)

First pass at moving view mode icons to screen options

  • src/wp-admin/edit.php

     
    195195                '<ul>' .
    196196                        '<li>' . __('You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.') . '</li>' .
    197197                        '<li>' . __('You can filter the list of posts by post status using the text links in the upper left to show All, Published, Draft, or Trashed posts. The default view is to show all posts.') . '</li>' .
    198                         '<li>' . __('You can view posts in a simple title list or with an excerpt. Choose the view you prefer by clicking on the icons at the top of the list on the right.') . '</li>' .
     198                        '<li>' . __('You can view posts in a simple title list or with an excerpt using the Screen Options tab.') . '</li>' .
    199199                        '<li>' . __('You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.') . '</li>' .
    200200                '</ul>'
    201201        ) );
     
    218218                '<p>' . __('You can also edit or move multiple posts to the trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.') . '</p>' .
    219219                                '<p>' . __('When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.') . '</p>'
    220220        ) );
    221 
    222221        get_current_screen()->set_help_sidebar(
    223222        '<p><strong>' . __('For more information:') . '</strong></p>' .
    224223        '<p>' . __('<a href="https://codex.wordpress.org/Posts_Screen" target="_blank">Documentation on Managing Posts</a>') . '</p>' .
  • src/wp-admin/includes/class-wp-posts-list-table.php

     
    472472                global $mode;
    473473
    474474                parent::pagination( $which );
    475 
    476                 if ( 'top' === $which && ! is_post_type_hierarchical( $this->screen->post_type ) )
    477                         $this->view_switcher( $mode );
    478475        }
    479476
    480477        /**
  • src/wp-admin/includes/class-wp-screen.php

     
    896896         */
    897897        public function render_screen_options( $options = array() ) {
    898898                global $wp_meta_boxes;
     899                global $mode;
    899900                $options = wp_parse_args( $options, array(
    900901                        'wrap' => true,
    901902                ) );
     
    960961                                ?>
    961962                                <br class="clear" />
    962963                        </div>
    963                 <?php endif;
     964                <?php endif; ?>
     965                       
     966                <?php
     967                /**
     968                 * Filter the post types that have different view mode options.
     969                 *
     970                 * @since 4.4
     971                 *
     972                 * @param array $view_mode_post_types Array of post types that can change view modes.
     973                 */
     974                $view_mode_post_types = apply_filters( 'view_mode_post_types', array( 'post' ) );
     975                if ( in_array( $this->post_type, $view_mode_post_types ) ) { ?>
     976                <div class="view-modes">
     977                        <h5>View Mode</h5>
     978                        <label for="list-view-mode">
     979                                <input id="list-view-mode" type="radio" name="mode" value="list" <?php checked( 'list', $mode ); ?> />
     980                                List View
     981                        </label>
     982                        <label for="excerpt-view-mode">
     983                                <input id="excerpt-view-mode" type="radio" name="mode" value="excerpt" <?php checked( 'excerpt', $mode ); ?> />
     984                                Excerpt View
     985                        </label>
     986                </div>
     987                <?php }
    964988
    965989                $this->render_screen_layout();
    966990                $this->render_per_page_options();
    967991                echo $this->_screen_settings;
    968 
    969992                ?>
    970993                <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>
    971994                </form>
  • src/wp-admin/includes/misc.php

     
    438438                }
    439439
    440440                update_user_meta($user->ID, $option, $value);
    441                 wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
     441
     442                $url = remove_query_arg( array( 'pagenum', 'apage', 'paged' ), wp_get_referer() );
     443                if ( isset( $_REQUEST['mode'] ) ) {
     444                        $url = add_query_arg( array( 'mode' => $_REQUEST['mode'] ), $url );
     445                }
     446
     447                wp_safe_redirect( $url );
    442448                exit;
    443449        }
    444450}