Merge pull request #961 from tresbach/develop
Allow setting 'options' for a scope in filter config
This commit is contained in:
commit
a748eb1b23
|
|
@ -114,7 +114,7 @@ class FilterScope
|
|||
protected function evalConfig($config)
|
||||
{
|
||||
if (isset($config['options'])) {
|
||||
$this->options($config['options']);
|
||||
$this->options = $config['options'];
|
||||
}
|
||||
if (isset($config['context'])) {
|
||||
$this->context = $config['context'];
|
||||
|
|
|
|||
|
|
@ -170,6 +170,10 @@ class Filter extends WidgetBase
|
|||
*/
|
||||
protected function getAvailableOptions($scope, $searchQuery = null)
|
||||
{
|
||||
if (count($scope->options)) {
|
||||
return $scope->options;
|
||||
}
|
||||
|
||||
$available = [];
|
||||
$nameColumn = $this->getScopeNameColumn($scope);
|
||||
$options = $this->getOptionsFromModel($scope, $searchQuery);
|
||||
|
|
@ -210,7 +214,7 @@ class Filter extends WidgetBase
|
|||
$query = $model->newQuery();
|
||||
|
||||
$this->fireEvent('filter.extendQuery', [$query, $scope]);
|
||||
|
||||
|
||||
if (!$searchQuery) {
|
||||
return $query->get();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue