Customize: Improve back-compat for wp.customize.Control subclasses that expect options.params to be present for direct manipulation before calling parent initialize method.

Fixes known incompatibility with Make theme.

Amends [41726].
See #30741.


git-svn-id: https://develop.svn.wordpress.org/trunk@41961 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-10-21 08:50:43 +00:00
parent 931bcb0f7d
commit dbfb9f0f0b

View File

@ -7635,20 +7635,23 @@
// Create Panels
$.each( api.settings.panels, function ( id, data ) {
var Constructor = api.panelConstructor[ data.type ] || api.Panel;
api.panel.add( new Constructor( id, data ) );
var Constructor = api.panelConstructor[ data.type ] || api.Panel, options;
options = _.extend( { params: data }, data ); // Inclusion of params alias is for back-compat for custom panels that expect to augment this property.
api.panel.add( new Constructor( id, options ) );
});
// Create Sections
$.each( api.settings.sections, function ( id, data ) {
var Constructor = api.sectionConstructor[ data.type ] || api.Section;
api.section.add( new Constructor( id, data ) );
var Constructor = api.sectionConstructor[ data.type ] || api.Section, options;
options = _.extend( { params: data }, data ); // Inclusion of params alias is for back-compat for custom sections that expect to augment this property.
api.section.add( new Constructor( id, options ) );
});
// Create Controls
$.each( api.settings.controls, function( id, data ) {
var Constructor = api.controlConstructor[ data.type ] || api.Control;
api.control.add( new Constructor( id, data ) );
var Constructor = api.controlConstructor[ data.type ] || api.Control, options;
options = _.extend( { params: data }, data ); // Inclusion of params alias is for back-compat for custom controls that expect to augment this property.
api.control.add( new Constructor( id, options ) );
});
// Focus the autofocused element