diff --git a/src/wp-admin/js/customize-widgets.js b/src/wp-admin/js/customize-widgets.js index 2472f1e2fc..0a4e1065fc 100644 --- a/src/wp-admin/js/customize-widgets.js +++ b/src/wp-admin/js/customize-widgets.js @@ -1709,20 +1709,20 @@ }, /** + * Get the widget_form Customize controls associated with the current sidebar. + * + * @since 3.9 * @return {wp.customize.controlConstructor.widget_form[]} */ getWidgetFormControls: function() { - var formControls; + var formControls = []; - formControls = _( this.setting() ).map( function( widgetId ) { + _( this.setting() ).each( function( widgetId ) { var settingId = widgetIdToSettingId( widgetId ), formControl = api.control( settingId ); - - if ( ! formControl ) { - return; + if ( formControl ) { + formControls.push( formControl ); } - - return formControl; } ); return formControls;