function hook_countries_alter

Same name and namespace in other branches
  1. 7.x modules/system/system.api.php \hook_countries_alter()
  2. 9 core/core.api.php \hook_countries_alter()
  3. 8.9.x core/core.api.php \hook_countries_alter()
  4. 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 function implements hook_countries_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

locale_test_countries_alter in core/modules/locale/tests/modules/locale_test/locale_test.module
Implements hook_countries_alter().
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 2158

Code

function hook_countries_alter(&$countries) {
    // Elbonia is now independent, so add it to the country list.
    $countries['EB'] = 'Elbonia';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.