WordPress.org

Make WordPress Core

Ticket #30325: view-switcher-modes-filter.30325-2.diff

File view-switcher-modes-filter.30325-2.diff, 1.1 KB (added by ragulka, 7 years ago)

Patch with braces around if statement

  • src/wp-admin/includes/class-wp-list-table.php

    diff --git src/wp-admin/includes/class-wp-list-table.php src/wp-admin/includes/class-wp-list-table.php
    index b698d58..a2465c3 100644
    class WP_List_Table { 
    537537         * @access protected
    538538         */
    539539        protected function view_switcher( $current_mode ) {
     540                /**
     541                 * Filter the list of available view modes.
     542                 *
     543                 * The dynamic portion of the hook name, $this->screen->id, refers
     544                 * to the ID of the current screen, usually a string.
     545                 *
     546                 * @since 4.1.0
     547                 *
     548                 * @param array $views An array of available views modes.
     549                 */
     550                $modes = apply_filters( "view_modes_{$this->screen->id}", $this->modes );
     551
     552                if ( empty( $modes ) ) {
     553                        return;
     554                }
     555
    540556?>
    541557                <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
    542558                <div class="view-switch">
    543559<?php
    544                         foreach ( $this->modes as $mode => $title ) {
     560                        foreach ( $modes as $mode => $title ) {
    545561                                $classes = array( 'view-' . $mode );
    546562                                if ( $current_mode == $mode )
    547563                                        $classes[] = 'current';