public function VatNumberController::euCountries in VAT Number 8
A list of valid countries of the EU.
Return value
array A list of EU countries, key is country code, value is readable name.
1 call to VatNumberController::euCountries()
- VatNumberController::checkVatFormat in src/Controller/ VatNumberController.php 
- Checks the VAT Number on its format.
File
- src/Controller/ VatNumberController.php, line 438 
Class
- VatNumberController
- Defines a controller to validate the VAT Number.
Namespace
Drupal\vat_number\ControllerCode
public function euCountries() {
  // Necessary for country_get_list().
  $countries = \Drupal::service('country_manager')
    ->getList();
  // ISO 3166.
  $eu_country_codes = [
    "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 $value) {
    $eu_countries[$value] = $countries[$value];
  }
  return $eu_countries;
}