mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 17:05:54 +02:00
Use Config to get Widget::$only_available_in
Added support for use of Config to set Widget::$only_available_in so widgets bundled with other modules can be hidden, ex. blog module.
This commit is contained in:
parent
a596374271
commit
eb092e7395
@ -49,9 +49,11 @@ class WidgetAreaEditor extends FormField {
|
||||
}
|
||||
|
||||
foreach($classes as $class) {
|
||||
|
||||
if (!empty($class::$only_available_in) && is_array($class::$only_available_in)){
|
||||
if(in_array($this->Name, $class::$only_available_in)) {
|
||||
|
||||
$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 {
|
||||
|
Loading…
Reference in New Issue
Block a user