diff --git src/wp-includes/customize/class-wp-customize-partial.php src/wp-includes/customize/class-wp-customize-partial.php
index 458fa1a..759df59 100644
|
|
class WP_Customize_Partial { |
176 | 176 | } |
177 | 177 | |
178 | 178 | if ( empty( $this->primary_setting ) ) { |
179 | | $this->primary_setting = current( $this->settings ); |
| 179 | if ( isset( $this->settings['default'] ) ) { |
| 180 | $this->primary_setting = $this->settings['default']; |
| 181 | } else { |
| 182 | $this->primary_setting = current( $this->settings ); |
| 183 | } |
180 | 184 | } |
181 | 185 | } |
182 | 186 | |
diff --git src/wp-includes/js/customize-selective-refresh.js src/wp-includes/js/customize-selective-refresh.js
index 5cf0799..9ad49d4 100644
|
|
wp.customize.selectiveRefresh = ( function( $, api ) { |
30 | 30 | * @augments wp.customize.Class |
31 | 31 | * @since 4.5.0 |
32 | 32 | * |
33 | | * @param {string} id Unique identifier for the control instance. |
34 | | * @param {object} options Options hash for the control instance. |
35 | | * @param {object} options.params |
36 | | * @param {string} options.params.type Type of partial (e.g. nav_menu, widget, etc) |
37 | | * @param {string} options.params.selector jQuery selector to find the container element in the page. |
38 | | * @param {array} options.params.settings The IDs for the settings the partial relates to. |
39 | | * @param {string} options.params.primarySetting The ID for the primary setting the partial renders. |
40 | | * @param {bool} options.params.fallbackRefresh Whether to refresh the entire preview in case of a partial refresh failure. |
| 33 | * @param {string} id Unique identifier for the control instance. |
| 34 | * @param {object} options Options hash for the control instance. |
| 35 | * @param {object} options.params |
| 36 | * @param {string} options.params.type Type of partial (e.g. nav_menu, widget, etc) |
| 37 | * @param {string} options.params.selector jQuery selector to find the container element in the page. |
| 38 | * @param {object|array} options.params.settings The IDs for the settings the partial relates to, either an array of IDs or an object mapping to setting values. |
| 39 | * @param {bool} options.params.fallbackRefresh Whether to refresh the entire preview in case of a partial refresh failure. |
41 | 40 | */ |
42 | 41 | Partial = self.Partial = api.Class.extend({ |
43 | 42 | |
… |
… |
wp.customize.selectiveRefresh = ( function( $, api ) { |
60 | 59 | partial.params = _.extend( |
61 | 60 | { |
62 | 61 | selector: null, |
63 | | settings: [], |
| 62 | settings: {}, |
64 | 63 | primarySetting: null, |
65 | 64 | containerInclusive: false, |
66 | 65 | fallbackRefresh: true // Note this needs to be false in a front-end editing context. |
… |
… |
wp.customize.selectiveRefresh = ( function( $, api ) { |
140 | 139 | */ |
141 | 140 | settings: function() { |
142 | 141 | var partial = this; |
143 | | if ( partial.params.settings && 0 !== partial.params.settings.length ) { |
| 142 | if ( _.isArray( partial.params.settings ) && 0 !== partial.params.settings.length ) { |
144 | 143 | return partial.params.settings; |
145 | | } else if ( partial.params.primarySetting ) { |
146 | | return [ partial.params.primarySetting ]; |
| 144 | } else if ( _.isObject( partial.params.settings ) ) { |
| 145 | return _.values( partial.params.settings ); |
147 | 146 | } else { |
148 | 147 | return [ partial.id ]; |
149 | 148 | } |
… |
… |
wp.customize.selectiveRefresh = ( function( $, api ) { |
176 | 175 | * @since 4.5.0 |
177 | 176 | */ |
178 | 177 | showControl: function() { |
179 | | var partial = this, settingId = partial.params.primarySetting; |
180 | | if ( ! settingId ) { |
| 178 | var partial = this, settingId; |
| 179 | if ( partial.params.primarySetting ) { |
| 180 | settingId = partial.params.primarySetting; |
| 181 | } else if ( _.isObject( partial.params.settings ) && partial.params.settings['default'] ) { |
| 182 | settingId = partial.params.settings['default']; |
| 183 | } else { |
181 | 184 | settingId = _.first( partial.settings() ); |
182 | 185 | } |
183 | 186 | api.preview.send( 'focus-control-for-setting', settingId ); |