public function PluginId::getValueOptions in Plugin 8.2
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 InOperator::getValueOptions
File
- src/
Plugin/ views/ filter/ PluginId.php, line 59
Class
- PluginId
- Provides a Views filter for plugin IDs.
Namespace
Drupal\plugin\Plugin\views\filterCode
public function getValueOptions() {
if (!is_null($this->valueOptions)) {
return $this->valueOptions;
}
$this->valueTitle = (string) $this->pluginType
->getLabel();
$this->valueOptions = array_reduce($this->pluginType
->getPluginManager()
->getDefinitions(), function (array $value_options, $plugin_definition) {
$plugin_definition = $this->pluginType
->ensureTypedPluginDefinition($plugin_definition);
$value_options[$plugin_definition
->getId()] = $plugin_definition instanceof PluginLabelDefinitionInterface ? $plugin_definition
->getLabel() : $plugin_definition
->getId();
return $value_options;
}, []);
natcasesort($this->valueOptions);
return $this->valueOptions;
}