public function ContextualBundle::getValueOptions in Entity Browser 8
Same name and namespace in other branches
- 8.2 src/Plugin/views/filter/ContextualBundle.php \Drupal\entity_browser\Plugin\views\filter\ContextualBundle::getValueOptions()
Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.
This can use a guard to be used to reduce database hits as much as possible.
Return value
array|null The stored values from $this->valueOptions.
Overrides Bundle::getValueOptions
File
- src/
Plugin/ views/ filter/ ContextualBundle.php, line 170
Class
- ContextualBundle
- Filter class which allows filtering by entity bundles.
Namespace
Drupal\entity_browser\Plugin\views\filterCode
public function getValueOptions() {
$this->valueOptions = parent::getValueOptions();
// Don't limit on config form, we'll display all greyed out.
if ($this->requestStack
->getCurrentRequest()->attributes
->get('_route') == 'views_ui.form_handler') {
return $this->valueOptions;
}
// Remove options that are not in this context.
foreach ($this->valueOptions as $key => $value) {
if (!in_array($key, $this->value)) {
unset($this->valueOptions[$key]);
}
}
return $this->valueOptions;
}