public function CountryItem::getValueOptions in Country 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
1 call to CountryItem::getValueOptions()
- CountryItem::query in src/
Plugin/ views/ filter/ CountryItem.php - Build query.
File
- src/
Plugin/ views/ filter/ CountryItem.php, line 232
Class
- CountryItem
- Filter by country ISO2.
Namespace
Drupal\country\Plugin\views\filterCode
public function getValueOptions() {
if (!is_null($this->valueOptions)) {
return $this->valueOptions;
}
$countries = $this->options['country_target_bundle'] == 'global' ? \Drupal::service('country_manager')
->getList() : \Drupal::service('country.field.manager')
->getSelectableCountries($this
->getFieldDefinition());
$this->valueOptions = $countries;
return $this->valueOptions;
}