function hook_countries_alter in Drupal 9
Same name and namespace in other branches
- 8 core/core.api.php \hook_countries_alter()
- 7 modules/system/system.api.php \hook_countries_alter()
- 10 core/core.api.php \hook_countries_alter()
Alter the default country list.
Parameters
$countries: The associative array of countries keyed by two-letter country code.
See also
\Drupal\Core\Locale\CountryManager::getList()
Related topics
1 invocation of hook_countries_alter()
- CountryManager::getList in core/
lib/ Drupal/ Core/ Locale/ CountryManager.php - Get an array of country code => country name pairs, altered by alter hooks.
File
- core/
core.api.php, line 2140 - Documentation landing page and topics, plus core library hooks.
Code
function hook_countries_alter(&$countries) {
// Elbonia is now independent, so add it to the country list.
$countries['EB'] = 'Elbonia';
}