function hook_countries_alter

Same name and namespace in other branches
  1. 9 core/core.api.php \hook_countries_alter()
  2. 8.9.x core/core.api.php \hook_countries_alter()
  3. 10 core/core.api.php \hook_countries_alter()
  4. 11.x core/core.api.php \hook_countries_alter()

Alter the default country list.

Parameters

$countries: The associative array of countries keyed by ISO 3166-1 country code.

See also

country_get_list()

_country_get_predefined_list()

Related topics

1 function implements hook_countries_alter()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

LocaleTestHooks::countriesAlter in core/modules/locale/tests/modules/locale_test/src/Hook/LocaleTestHooks.php
Implements hook_countries_alter().
1 invocation of hook_countries_alter()
country_get_list in includes/locale.inc
Get list of all predefined and custom countries.

File

modules/system/system.api.php, line 4727

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.