You are here

function countries_countries_alter in Countries 7

Same name and namespace in other branches
  1. 8 countries.module \countries_countries_alter()
  2. 7.2 countries.module \countries_countries_alter()

Implement hook_countries_alter().

Currently the only usage in core is in system module when setting the sites default country.

File

./countries.module, line 267

Code

function countries_countries_alter(&$countries) {
  $enabled_countries =& drupal_static(__FUNCTION__, array());
  if (empty($enabled_countries)) {
    $countries = countries_get_countries();
    foreach ($countries as $country) {
      if ($country->enabled) {
        $enabled_countries[$country->iso2] = $country->name;
      }
    }
    asort($enabled_countries);
  }
  $countries = array_intersect_key($enabled_countries, $countries);
}