diff --git a/modules/backend/widgets/Filter.php b/modules/backend/widgets/Filter.php index c33dea08d..00439d605 100644 --- a/modules/backend/widgets/Filter.php +++ b/modules/backend/widgets/Filter.php @@ -15,6 +15,25 @@ use ApplicationException; */ class Filter extends WidgetBase { + // + // Configurable properties + // + + /** + * @var array Scope definition configuration. + */ + public $scopes; + + /** + * @var string The context of this filter, scopes that do not belong + * to this context will not be shown. + */ + protected $context = null; + + // + // Object properties + // + /** * {@inheritDoc} */ @@ -35,12 +54,6 @@ class Filter extends WidgetBase */ protected $scopeModels = []; - /** - * @var string The context of this filter, scopes that do not belong - * to this context will not be shown. - */ - protected $activeContext = null; - /** * @var array List of CSS classes to apply to the filter container element */ @@ -51,7 +64,10 @@ class Filter extends WidgetBase */ public function init() { - $this->activeContext = $this->getConfig('context'); + $this->fillFromConfig([ + 'scopes', + 'context', + ]); } /** @@ -241,11 +257,11 @@ class Filter extends WidgetBase /* * All scopes */ - if (!isset($this->config->scopes) || !is_array($this->config->scopes)) { - $this->config->scopes = []; + if (!isset($this->scopes) || !is_array($this->scopes)) { + $this->scopes = []; } - $this->addScopes($this->config->scopes); + $this->addScopes($this->scopes); /* * Extensibility @@ -442,10 +458,11 @@ class Filter extends WidgetBase /** * Returns the active context for displaying the filter. + * @return string */ public function getContext() { - return $this->activeContext; + return $this->context; } //