I have a requirement to add additional countries to the location module.

I need to add England, Scotland, Wales and Northern Island.

I suppose they could be provinces, but I can't figure out how to do that either.

Many thanks for any help :)

PS. I would be using the county codes for css so country would be better.


So maybe my question wasn't worded in the best way, but I have found the answer.

All countries in Drupal (at least in 7) are taken from the /includes/iso.inc file. This includes Location and Address Field.

You can add countries to this list via drupal_alter

An example:

function hook_countries_alter(&$countries) {
  // Elbonia is now independent, so add it to the country list.
  $countries['EB'] = 'Elbonia';

Putting this in a custom module will enable you to add countries as you require. You must use a 2 letter iso code!

  • How about country module and countries api module? – Umair Apr 16 '17 at 18:23
  • 1
    There is a countries (drupal.org/project/countries) for D7 that does about the same with an interface, but the others are not aplicable for D7. – mediaashley Apr 17 '17 at 12:16
  • What would you suggest for country flag icons? – Umair Apr 18 '17 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.