Customizer: Apply `customize_dynamic_setting_class` and `customize_dynamic_setting_args` filters in calls to `WP_Customize_Manager::add_setting( $id, $args )`.

Ensure that plugin filters apply as expected for any settings registered statically without passing in an explicit class instance to `WP_Customize_Manager::add_setting()`.

Fixes #34597.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2015-12-06 23:22:25 +00:00
parent 699c377856
commit 07339e61c0
2 changed files with 10 additions and 2 deletions

View File

@ -1049,7 +1049,15 @@ final class WP_Customize_Manager {
if ( $id instanceof WP_Customize_Setting ) { if ( $id instanceof WP_Customize_Setting ) {
$setting = $id; $setting = $id;
} else { } else {
$setting = new WP_Customize_Setting( $this, $id, $args ); $class = 'WP_Customize_Setting';
/** This filter is documented in wp-includes/class-wp-customize-manager.php */
$args = apply_filters( 'customize_dynamic_setting_args', $args, $id );
/** This filter is documented in wp-includes/class-wp-customize-manager.php */
$class = apply_filters( 'customize_dynamic_setting_class', $class, $id, $args );
$setting = new $class( $this, $id, $args );
} }
$this->settings[ $setting->id ] = $setting; $this->settings[ $setting->id ] = $setting;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.5-alpha-35809'; $wp_version = '4.5-alpha-35810';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.