Make WordPress Core

Changeset 41961


Ignore:
Timestamp:
10/21/2017 08:50:43 AM (4 years ago)
Author:
westonruter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/customize-controls.js

    r41960 r41961  
    76367636        // Create Panels
    76377637        $.each( api.settings.panels, function ( id, data ) {
    7638             var Constructor = api.panelConstructor[ data.type ] || api.Panel;
    7639             api.panel.add( new Constructor( id, data ) );
     7638            var Constructor = api.panelConstructor[ data.type ] || api.Panel, options;
     7639            options = _.extend( { params: data }, data ); // Inclusion of params alias is for back-compat for custom panels that expect to augment this property.
     7640            api.panel.add( new Constructor( id, options ) );
    76407641        });
    76417642
    76427643        // Create Sections
    76437644        $.each( api.settings.sections, function ( id, data ) {
    7644             var Constructor = api.sectionConstructor[ data.type ] || api.Section;
    7645             api.section.add( new Constructor( id, data ) );
     7645            var Constructor = api.sectionConstructor[ data.type ] || api.Section, options;
     7646            options = _.extend( { params: data }, data ); // Inclusion of params alias is for back-compat for custom sections that expect to augment this property.
     7647            api.section.add( new Constructor( id, options ) );
    76467648        });
    76477649
    76487650        // Create Controls
    76497651        $.each( api.settings.controls, function( id, data ) {
    7650             var Constructor = api.controlConstructor[ data.type ] || api.Control;
    7651             api.control.add( new Constructor( id, data ) );
     7652            var Constructor = api.controlConstructor[ data.type ] || api.Control, options;
     7653            options = _.extend( { params: data }, data ); // Inclusion of params alias is for back-compat for custom controls that expect to augment this property.
     7654            api.control.add( new Constructor( id, options ) );
    76527655        });
    76537656
Note: See TracChangeset for help on using the changeset viewer.