function InOperator::getValueOptions

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/filter/InOperator.php \Drupal\views\Plugin\views\filter\InOperator::getValueOptions()
  2. 8.9.x core/modules/views/src/Plugin/views/filter/InOperator.php \Drupal\views\Plugin\views\filter\InOperator::getValueOptions()
  3. 10 core/modules/views/src/Plugin/views/filter/InOperator.php \Drupal\views\Plugin\views\filter\InOperator::getValueOptions()

Gets the value options.

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.

4 calls to InOperator::getValueOptions()
EntityReference::valueFormAddSelect in core/modules/views/src/Plugin/views/filter/EntityReference.php
Adds a select element to the form.
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
Gets the value options.
DblogTypes::getValueOptions in core/modules/dblog/src/Plugin/views/filter/DblogTypes.php
Gets the value options.
LanguageFilter::getValueOptions in core/modules/views/src/Plugin/views/filter/LanguageFilter.php
Gets the value options.
ModerationStateFilter::getValueOptions in core/modules/content_moderation/src/Plugin/views/filter/ModerationStateFilter.php
Gets the value options.
Name::getValueOptions in core/modules/user/src/Plugin/views/filter/Name.php
Gets the value options.

... See full list

File

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

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 = [
            $this->t('Yes'),
            $this->t('No'),
        ];
    }
    return $this->valueOptions;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.