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 2116
Documentation landing page and topics, plus core library hooks.

Code

1
2
3
4
function hook_countries_alter(&$countries) {
  // Elbonia is now independent, so add it to the country list.
  $countries['EB'] = 'Elbonia';
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.