You are here

public function CountryManager::getList in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Locale/CountryManager.php \Drupal\Core\Locale\CountryManager::getList()
  2. 9 core/lib/Drupal/Core/Locale/CountryManager.php \Drupal\Core\Locale\CountryManager::getList()

Get an array of country code => country name pairs, altered by alter hooks.

Return value

array An array of country code => country name pairs.

See also

\Drupal\Core\Locale\CountryManager::getStandardList()

File

core/lib/Drupal/Core/Locale/CountryManager.php, line 318

Class

CountryManager
Provides list of countries.

Namespace

Drupal\Core\Locale

Code

public function getList() {

  // Populate the country list if it is not already populated.
  if (!isset($this->countries)) {
    $this->countries = static::getStandardList();
    $this->moduleHandler
      ->alter('countries', $this->countries);
  }
  return $this->countries;
}