You are here

public function AdministrativeArea::getValueOptions in Address 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 InOperator::getValueOptions

File

src/Plugin/views/filter/AdministrativeArea.php, line 532

Class

AdministrativeArea
Filter by administrative area.

Namespace

Drupal\address\Plugin\views\filter

Code

public function getValueOptions() {
  $this->valueOptions = [];
  if ($country_code = $this
    ->getCurrentCountry()) {
    $parents[] = $country_code;
    $locale = \Drupal::languageManager()
      ->getConfigOverrideLanguage()
      ->getId();
    $subdivisions = $this->subdivisionRepository
      ->getList($parents, $locale);
    $this->valueOptions = $subdivisions;
  }
  return $this->valueOptions;
}