Customizer: Fix previewing and applying widgets when previewing another theme.

* Unset `wp_get_sidebars_widgets()`' non-admin cache var `$_wp_sidebars_widgets` in Customize theme preview.
* Add `WP_Customize_Setting::$dirty` so that settings can be initially-dirty when the Customizer loads.
* Mark `old_sidebars_widgets_data` setting initially-dirty.
* Mark all `sidebars_widgets` settings as initially-dirty during theme switch.

props westonruter.
see #31484.

git-svn-id: https://develop.svn.wordpress.org/trunk@31705 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90)
2015-03-10 22:38:30 +00:00
parent 4aeeb0e0f0
commit 63502a8a01
5 changed files with 24 additions and 1 deletions

View File

@@ -60,6 +60,20 @@ class WP_Customize_Setting {
public $sanitize_callback = '';
public $sanitize_js_callback = '';
/**
* Whether or not the setting is initially dirty when created.
*
* This is used to ensure that a setting will be sent from the pane to the
* preview when loading the Customizer. Normally a setting only is synced to
* the preview if it has been changed. This allows the setting to be sent
* from the start.
*
* @since 4.2.0
* @access public
* @var bool
*/
public $dirty = false;
protected $id_data = array();
/**