Customize: Ease extendability of filter drawer

By moving the `wporg` conditional inside the method body, the filter drawer can be overridden without having to also override the entire section template.

Props celloexpressions.
Closes #42212.


Built from https://develop.svn.wordpress.org/trunk@41973


git-svn-id: http://core.svn.wordpress.org/trunk@41807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Konstantin Obenland 2017-10-23 18:58:46 +00:00
parent 69518459e6
commit 91ad9114d0
2 changed files with 17 additions and 18 deletions

View File

@ -80,9 +80,7 @@ class WP_Customize_Themes_Section extends WP_Customize_Section {
<div class="customize-preview-header themes-filter-bar">
<?php $this->filter_bar_content_template(); ?>
</div>
<# if ( 'wporg' === data.action ) { #>
<?php $this->filter_drawer_content_template(); ?>
<# } #>
<?php $this->filter_drawer_content_template(); ?>
<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>
<ul class="themes">
</ul>
@ -150,7 +148,6 @@ class WP_Customize_Themes_Section extends WP_Customize_Section {
/**
* Render the filter drawer portion of a themes section as a JS template.
*
* The template is only rendered by PHP once, so all actions are prepared at once on the server side.
* The filter bar container is rendered by @see `render_template()`.
*
* @since 4.9.0
@ -158,19 +155,21 @@ class WP_Customize_Themes_Section extends WP_Customize_Section {
protected function filter_drawer_content_template() {
$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.
?>
<div class="filter-drawer filter-details">
<?php foreach ( $feature_list as $feature_name => $features ) : ?>
<fieldset class="filter-group">
<legend><?php echo esc_html( $feature_name ); ?></legend>
<div class="filter-group-feature">
<?php foreach ( $features as $feature => $feature_name ) : ?>
<input type="checkbox" id="filter-id-<?php echo esc_attr( $feature ); ?>" value="<?php echo esc_attr( $feature ); ?>" />
<label for="filter-id-<?php echo esc_attr( $feature ); ?>"><?php echo esc_html( $feature_name ); ?></label><br>
<?php endforeach; ?>
</div>
</fieldset>
<?php endforeach; ?>
</div>
<# if ( 'wporg' === data.action ) { #>
<div class="filter-drawer filter-details">
<?php foreach ( $feature_list as $feature_name => $features ) : ?>
<fieldset class="filter-group">
<legend><?php echo esc_html( $feature_name ); ?></legend>
<div class="filter-group-feature">
<?php foreach ( $features as $feature => $feature_name ) : ?>
<input type="checkbox" id="filter-id-<?php echo esc_attr( $feature ); ?>" value="<?php echo esc_attr( $feature ); ?>" />
<label for="filter-id-<?php echo esc_attr( $feature ); ?>"><?php echo esc_html( $feature_name ); ?></label><br>
<?php endforeach; ?>
</div>
</fieldset>
<?php endforeach; ?>
</div>
<# } #>
<?php
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-beta3-41972';
$wp_version = '4.9-beta3-41973';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.