From ac1c1dabc8e2dd47bac5bc6b372cefec5466f14f Mon Sep 17 00:00:00 2001 From: sinan-evanshunt Date: Thu, 6 Sep 2018 09:43:05 -0600 Subject: [PATCH] Update WidgetAreaEditor.php --- code/form/WidgetAreaEditor.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/code/form/WidgetAreaEditor.php b/code/form/WidgetAreaEditor.php index 8c7363b..1bb9cdf 100644 --- a/code/form/WidgetAreaEditor.php +++ b/code/form/WidgetAreaEditor.php @@ -50,15 +50,17 @@ class WidgetAreaEditor extends FormField unset($classes[0]); } - foreach ($classes as $class) { - $available = Config::inst()->get($class, 'only_available_in'); - - if (!empty($available) && is_array($available)) { - if (in_array($this->Name, $available)) { + if( isset($classes) ){ + foreach ($classes as $class) { + $available = Config::inst()->get($class, 'only_available_in'); + + if (!empty($available) && is_array($available)) { + if (in_array($this->Name, $available)) { + $widgets->push(singleton($class)); + } + } else { $widgets->push(singleton($class)); } - } else { - $widgets->push(singleton($class)); } } }