Make WordPress Core


Ignore:
Timestamp:
10/18/2017 03:10:19 PM (8 years ago)
Author:
obenland
Message:

Customize: Unstick filter pane in Theme selector

Prevents the filter pane from blocking the view of theme search results when it's open.
Users are now able to just scroll to view results.

Props rclations.
Fixes #42212.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-themes-section.php

    r41893 r41903  
    8181                        <?php $this->filter_bar_content_template(); ?>
    8282                    </div>
     83                    <# if ( 'wporg' === data.action ) { #>
     84                        <?php $this->filter_drawer_content_template(); ?>
     85                    <# } #>
    8386                    <div class="error unexpected-error" style="display: none; "><p><?php _e( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ); ?></p></div>
    8487                    <ul class="themes">
     
    126129                </span>
    127130            </button>
    128             <div class="filter-drawer filter-details">
    129                 <?php
    130                 $feature_list = get_theme_feature_list( false ); // @todo: Use the .org API instead of the local core feature list. The .org API is currently outdated and will be reconciled when the .org themes directory is next redesigned.
    131                 foreach ( $feature_list as $feature_name => $features ) {
    132                     echo '<fieldset class="filter-group">';
    133                     echo '<legend>' . esc_html( $feature_name ) . '</legend>';
    134                     echo '<div class="filter-group-feature">';
    135                     foreach ( $features as $feature => $feature_name ) {
    136                         echo '<input type="checkbox" id="filter-id-' . esc_attr( $feature ) . '" value="' . esc_attr( $feature ) . '" /> ';
    137                         echo '<label for="filter-id-' . esc_attr( $feature ) . '">' . esc_html( $feature_name ) . '</label><br>';
    138                     }
    139                     echo '</div>';
    140                     echo '</fieldset>';
    141                 }
    142                 ?>
    143             </div>
    144131        <# } else { #>
    145132            <div class="themes-filter-container">
     
    160147        <?php
    161148    }
     149
     150    /**
     151     * Render the filter drawer portion of a themes section as a JS template.
     152     *
     153     * The template is only rendered by PHP once, so all actions are prepared at once on the server side.
     154     * The filter bar container is rendered by @see `render_template()`.
     155     *
     156     * @since 4.9.0
     157     */
     158    protected function filter_drawer_content_template() {
     159        $feature_list = get_theme_feature_list( false ); // @todo: Use the .org API instead of the local core feature list. The .org API is currently outdated and will be reconciled when the .org themes directory is next redesigned.
     160        ?>
     161        <div class="filter-drawer filter-details">
     162            <?php foreach ( $feature_list as $feature_name => $features ) : ?>
     163                <fieldset class="filter-group">
     164                    <legend><?php echo esc_html( $feature_name ); ?></legend>
     165                    <div class="filter-group-feature">
     166                        <?php foreach ( $features as $feature => $feature_name ) : ?>
     167                            <input type="checkbox" id="filter-id-<?php echo esc_attr( $feature ); ?>" value="<?php echo esc_attr( $feature ); ?>" />
     168                            <label for="filter-id-<?php echo esc_attr( $feature ); ?>"><?php echo esc_html( $feature_name ); ?></label><br>
     169                        <?php endforeach; ?>
     170                    </div>
     171                </fieldset>
     172            <?php endforeach; ?>
     173        </div>
     174        <?php
     175    }
    162176}
Note: See TracChangeset for help on using the changeset viewer.