You are here

public function WebformSubmissionSelectFilter::getValueOptions in Webform Views Integration 8.5

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

1 method overrides WebformSubmissionSelectFilter::getValueOptions()
WebformSubmissionEntityReferenceSelectFilter::getValueOptions in src/Plugin/views/filter/WebformSubmissionEntityReferenceSelectFilter.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.

File

src/Plugin/views/filter/WebformSubmissionSelectFilter.php, line 70

Class

WebformSubmissionSelectFilter
Select filter based on value of a webform submission.

Namespace

Drupal\webform_views\Plugin\views\filter

Code

public function getValueOptions() {
  if (!isset($this->valueOptions)) {
    $element = $this
      ->getWebformElement();

    // We need this explicit "all" option because otherwise
    // InOperator::validate() rises validation errors when we are an exposed
    // required filter without default value nor without submitted exposed
    // input.
    $this->valueOptions = [
      self::ALL => $this
        ->t('All'),
    ];
    $this->valueOptions += $element['#options'];
  }
  return $this->valueOptions;
}