Merge pull request #176 from evanshunt/sinan-evanshunt-patch-1

Update WidgetAreaEditor.php
This commit is contained in:
Guy Marriott 2018-09-11 09:44:26 +12:00 committed by GitHub
commit d7dbf85426
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,17 +42,17 @@ class WidgetAreaEditor extends FormField
$widgets= new ArrayList();
foreach ($this->widgetClasses as $widgetClass) {
$classes = ClassInfo::subclassesFor($widgetClass);
$classes = ClassInfo::subclassesFor($widgetClass) ?: array();
if (isset($classes['Widget'])) {
unset($classes['Widget']);
} elseif (isset($classes[0]) && $classes[0] == 'Widget') {
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)) {
$widgets->push(singleton($class));
@ -62,7 +62,7 @@ class WidgetAreaEditor extends FormField
}
}
}
return $widgets;
}