Customizer: Introduce customize_loaded_components filter to allow core components to be disabled.
Also move style rule from `customize-nav-menus.css` to `customize-controls.css` so that widgets button is properly styled when `nav_menus` component is excluded from loading. See [35304]. See #33327. Props westonruter, DrewAPicture. Fixes #33552. Built from https://develop.svn.wordpress.org/trunk@35307 git-svn-id: http://core.svn.wordpress.org/trunk@35273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -191,11 +191,32 @@ final class WP_Customize_Manager {
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-panel.php' );
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-section.php' );
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-control.php' );
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-nav-menus.php' );
|
||||
|
||||
$this->widgets = new WP_Customize_Widgets( $this );
|
||||
$this->nav_menus = new WP_Customize_Nav_Menus( $this );
|
||||
/**
|
||||
* Filter the core Customizer components to load.
|
||||
*
|
||||
* This allows Core components to be excluded from being instantiated by
|
||||
* filtering them out of the array. Note that this filter generally runs
|
||||
* during the <code>plugins_loaded</code> action, so it cannot be added
|
||||
* in a theme.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @see WP_Customize_Manager::__construct()
|
||||
*
|
||||
* @param array $components List of core components to load.
|
||||
* @param WP_Customize_Manager $this WP_Customize_Manager instance.
|
||||
*/
|
||||
$components = apply_filters( 'customize_loaded_components', array( 'widgets', 'nav_menus' ), $this );
|
||||
|
||||
if ( in_array( 'widgets', $components ) ) {
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
|
||||
$this->widgets = new WP_Customize_Widgets( $this );
|
||||
}
|
||||
if ( in_array( 'nav_menus', $components ) ) {
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-nav-menus.php' );
|
||||
$this->nav_menus = new WP_Customize_Nav_Menus( $this );
|
||||
}
|
||||
|
||||
add_filter( 'wp_die_handler', array( $this, 'wp_die_handler' ) );
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-alpha-35306';
|
||||
$wp_version = '4.4-alpha-35307';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user