public function CountryManager::getAvailableList in Ubercart 8.4
Returns a list of all available country code => country name pairs.
Return value
array An array of country code => country name pairs.
Overrides CountryManagerInterface::getAvailableList
File
- uc_country/
src/ CountryManager.php, line 70
Class
- CountryManager
- Provides list of countries.
Namespace
Drupal\uc_countryCode
public function getAvailableList() {
$countries = $this->entityTypeManager
->getStorage('uc_country')
->loadMultiple(NULL);
$country_names = [];
foreach ($countries as $alpha_2 => $country) {
// We can use non-literals in t() here because the country names are
// defined in configuration files, so they have been translated.
$country_names[$alpha_2] = $this
->t($country
->getName());
}
natcasesort($country_names);
$this->moduleHandler
->alter('countries', $country_names);
return $country_names;
}