mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 17:05:54 +02:00
Merge pull request #176 from evanshunt/sinan-evanshunt-patch-1
Update WidgetAreaEditor.php
This commit is contained in:
commit
d7dbf85426
@ -42,17 +42,17 @@ class WidgetAreaEditor extends FormField
|
|||||||
$widgets= new ArrayList();
|
$widgets= new ArrayList();
|
||||||
|
|
||||||
foreach ($this->widgetClasses as $widgetClass) {
|
foreach ($this->widgetClasses as $widgetClass) {
|
||||||
$classes = ClassInfo::subclassesFor($widgetClass);
|
$classes = ClassInfo::subclassesFor($widgetClass) ?: array();
|
||||||
|
|
||||||
if (isset($classes['Widget'])) {
|
if (isset($classes['Widget'])) {
|
||||||
unset($classes['Widget']);
|
unset($classes['Widget']);
|
||||||
} elseif (isset($classes[0]) && $classes[0] == 'Widget') {
|
} elseif (isset($classes[0]) && $classes[0] == 'Widget') {
|
||||||
unset($classes[0]);
|
unset($classes[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($classes as $class) {
|
foreach ($classes as $class) {
|
||||||
$available = Config::inst()->get($class, 'only_available_in');
|
$available = Config::inst()->get($class, 'only_available_in');
|
||||||
|
|
||||||
if (!empty($available) && is_array($available)) {
|
if (!empty($available) && is_array($available)) {
|
||||||
if (in_array($this->Name, $available)) {
|
if (in_array($this->Name, $available)) {
|
||||||
$widgets->push(singleton($class));
|
$widgets->push(singleton($class));
|
||||||
@ -62,7 +62,7 @@ class WidgetAreaEditor extends FormField
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $widgets;
|
return $widgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user