From 61dfcc3b4ce6979da89e826b811dc63dbb60568a Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Fri, 27 Feb 2015 10:34:42 +0000 Subject: [PATCH] Customize Widgets: Don't return undefined items in getWidgetFormControls method. props westonruter. fixes #31465. git-svn-id: https://develop.svn.wordpress.org/trunk@31570 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/customize-widgets.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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;