You are here

public function InOperator::getValueOptions in Drupal 9

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

3 calls to InOperator::getValueOptions()
InOperator::adminSummary in core/modules/views/src/Plugin/views/filter/InOperator.php
Display the filter on the administrative summary.
InOperator::validate in core/modules/views/src/Plugin/views/filter/InOperator.php
Validate that the plugin is correct and can be saved.
InOperator::valueForm in core/modules/views/src/Plugin/views/filter/InOperator.php
Options form subform for setting options.
10 methods override InOperator::getValueOptions()
Bundle::getValueOptions in core/modules/views/src/Plugin/views/filter/Bundle.php
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.
DblogTypes::getValueOptions in core/modules/dblog/src/Plugin/views/filter/DblogTypes.php
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.
LanguageFilter::getValueOptions in core/modules/views/src/Plugin/views/filter/LanguageFilter.php
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.
ModerationStateFilter::getValueOptions in core/modules/content_moderation/src/Plugin/views/filter/ModerationStateFilter.php
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.
Name::getValueOptions in core/modules/user/src/Plugin/views/filter/Name.php
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.

... See full list

File

core/modules/views/src/Plugin/views/filter/InOperator.php, line 61

Class

InOperator
Simple filter to handle matching of multiple options selectable via checkboxes.

Namespace

Drupal\views\Plugin\views\filter

Code

public function getValueOptions() {
  if (isset($this->valueOptions)) {
    return $this->valueOptions;
  }
  if (isset($this->definition['options callback']) && is_callable($this->definition['options callback'])) {
    if (isset($this->definition['options arguments']) && is_array($this->definition['options arguments'])) {
      $this->valueOptions = call_user_func_array($this->definition['options callback'], $this->definition['options arguments']);
    }
    else {
      $this->valueOptions = call_user_func($this->definition['options callback']);
    }
  }
  else {
    $this->valueOptions = [
      t('Yes'),
      $this
        ->t('No'),
    ];
  }
  return $this->valueOptions;
}