From dbfb9f0f0b4be940a6c4014d9e7d613e76b545fa Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sat, 21 Oct 2017 08:50:43 +0000 Subject: [PATCH] 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 --- src/wp-admin/js/customize-controls.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 83db9651ca..5990208b32 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -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