You are here

public function LanguageFilter::getValueOptions in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/filter/LanguageFilter.php \Drupal\views\Plugin\views\filter\LanguageFilter::getValueOptions()
  2. 10 core/modules/views/src/Plugin/views/filter/LanguageFilter.php \Drupal\views\Plugin\views\filter\LanguageFilter::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 InOperator::getValueOptions

File

core/modules/views/src/Plugin/views/filter/LanguageFilter.php, line 60

Class

LanguageFilter
Provides filtering by language.

Namespace

Drupal\views\Plugin\views\filter

Code

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));
  }
  return $this->valueOptions;
}