Make WordPress Core

Changeset 31570


Ignore:
Timestamp:
02/27/2015 10:34:42 AM (9 years ago)
Author:
ocean90
Message:

Customize Widgets: Don't return undefined items in getWidgetFormControls method.

props westonruter.
fixes #31465.

File:
1 edited

Legend:

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

    r31471 r31570  
    17101710
    17111711        /**
     1712         * Get the widget_form Customize controls associated with the current sidebar.
     1713         *
     1714         * @since 3.9
    17121715         * @return {wp.customize.controlConstructor.widget_form[]}
    17131716         */
    17141717        getWidgetFormControls: function() {
    1715             var formControls;
    1716 
    1717             formControls = _( this.setting() ).map( function( widgetId ) {
     1718            var formControls = [];
     1719
     1720            _( this.setting() ).each( function( widgetId ) {
    17181721                var settingId = widgetIdToSettingId( widgetId ),
    17191722                    formControl = api.control( settingId );
    1720 
    1721                 if ( ! formControl ) {
    1722                     return;
    1723                 }
    1724 
    1725                 return formControl;
     1723                if ( formControl ) {
     1724                    formControls.push( formControl );
     1725                }
    17261726            } );
    17271727
Note: See TracChangeset for help on using the changeset viewer.