You are here

function _vat_number_eu_countries in VAT Number 7

A list of valid countrys of the EU

Return value

array a list of eu countrys, key is country code, value is readable name

1 call to _vat_number_eu_countries()
_vat_number_check_vat_format in ./vat_number.inc
Pre check, to output good error messages that can help the user.

File

./vat_number.inc, line 365
vat_number.inc

Code

function _vat_number_eu_countries() {

  // Necessary for country_get_list().
  require_once DRUPAL_ROOT . '/includes/locale.inc';
  $countries = country_get_list();

  // ISO 3166-1 alpha-2 country codes
  $eu_country_codes = array(
    "AT",
    "BE",
    "BG",
    "CY",
    "CZ",
    "DE",
    "DK",
    "EE",
    "ES",
    "FI",
    "FR",
    "GB",
    "GR",
    "HR",
    "HU",
    "IE",
    "IT",
    "LT",
    "LU",
    "LV",
    "MT",
    "NL",
    "PL",
    "PT",
    "RO",
    "SE",
    "SI",
    "SK",
  );

  // Merge in country names from country_get_list().
  foreach ($eu_country_codes as $key => $value) {
    $eu_countries[$value] = $countries[$value];
  }
  return $eu_countries;
}