W3cubDocs

/Drupal 8

function hook_countries_alter

hook_countries_alter(&$countries)

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

Hooks
Define functions that alter the behavior of Drupal core.

File

core/core.api.php, line 2101
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';
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!core.api.php/function/hook_countries_alter/8.1.x