public function LanguageFilter::getValueOptions in Custom Language field 8
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 LanguageFilter::getValueOptions
File
- src/
Plugin/ views/ filter/ LanguageFilter.php, line 22
Class
- LanguageFilter
- Provides filtering by language.
Namespace
Drupal\languagefield\Plugin\views\filterCode
public function getValueOptions() {
if (!isset($this->valueOptions)) {
$this->valueTitle = $this
->t('Language');
// Pass the current values so options that are already selected do not get
// lost when there are changes in the language configuration.
// $this->valueOptions = $this->listLanguages(LanguageInterface::STATE_ALL
// | LanguageInterface::STATE_SITE_DEFAULT
// | PluginBase::INCLUDE_NEGOTIATED, array_keys($this->value));
// .
$field_storage = $this
->getFieldStorageDefinition();
$this->valueOptions = options_allowed_values($field_storage);
}
return $this->valueOptions;
}