From eb092e7395dba08361159f573eb1f9ef82f9b9bf Mon Sep 17 00:00:00 2001 From: Ryan Wachtl Date: Fri, 16 Aug 2013 19:46:39 -0500 Subject: [PATCH] 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. --- code/form/WidgetAreaEditor.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/form/WidgetAreaEditor.php b/code/form/WidgetAreaEditor.php index 4b5918f..a2bb0de 100644 --- a/code/form/WidgetAreaEditor.php +++ b/code/form/WidgetAreaEditor.php @@ -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 {