public function AdministrativeArea::getAdministrativeAreaCountries in Address 8
Gets a list of countries that have administrative areas.
Parameters
array $available_countries: The available countries to filter by. Defaults to the available countries for this filter.
Return value
array An array of country names, keyed by country code.
1 call to AdministrativeArea::getAdministrativeAreaCountries()
- AdministrativeArea::buildOptionsForm in src/
Plugin/ views/ filter/ AdministrativeArea.php - Provide the basic form which calls through to subforms. If overridden, it is best to call through to the parent, or to at least make sure all of the functions in this form are called.
File
- src/
Plugin/ views/ filter/ AdministrativeArea.php, line 586
Class
- AdministrativeArea
- Filter by administrative area.
Namespace
Drupal\address\Plugin\views\filterCode
public function getAdministrativeAreaCountries(array $available_countries = NULL) {
if (!isset($available_countries)) {
$available_countries = $this
->getAvailableCountries();
}
$countries = [];
foreach ($available_countries as $country_code => $country_name) {
$address_format = $this->addressFormatRepository
->get($country_code);
$subdivision_depth = $address_format
->getSubdivisionDepth();
if ($subdivision_depth > 0) {
$countries[$country_code] = $country_name;
}
}
return $countries;
}