Use Countries module (http://drupal.org/project/countries) instead of a regular drop-down...

Comments

adam_b’s picture

+1

klonos’s picture

...you've beat me by a couple of days in filing an issue for this ;)

guillaumev’s picture

+1

kojow7’s picture

+1

Eric Anfrui’s picture

+1
It would be great

warmth’s picture

+1 any news?

rszrama’s picture

Status: Active » Closed (won't fix)

That module takes a pretty heavy-handed approach to countries by making every country into an editable entity. It's very feature-rich, but it also seems a bit much for Address Field to depend on. My recommendation would be either 1) a feature request in that module to replace itself into the Country select list used by Address Field or 2) a contributed module that ties them together, likely through an address field format plugin.

Also, I'm not really sure what the integration between these two modules would really look like. I don't think it should just be a simple case of "call this function to get a countries list instead of that one", though that would be a good starting point. Could be some tie-in to #1829900: [meta] Address Field 2.x needs pluggable administrative areas and an actual API.

klonos’s picture

Title: Use Countries module » Support Countries module for populating the country drop-down menu.
Status: Closed (won't fix) » Active

Nobody suggested anything about depending on the module rather about supporting it if installed. Hope the title change makes that clearer now.

PS: don't mean to ping/pong status change with you, just don't want this clarification to drop off your radar in case you filter closed issues out of view. Thanx and sorry.

jnicola’s picture

Added patch that alters the list of countries in function _addressfield_country_options_list() so as it uses the countries module method of getting countries if the module exists and is enabled. If not, uses standard approach.

I also removed the second setting of $countries in the if statement within the foreach. This seems redundant and purposeless. I wish there was a comment to explain why this was placed there, but since there wasn't, and both a code review and testing demonstrated this as useless locally, I have removed it for simplicities sake.

jnicola’s picture

Status: Active » Needs review
bojanz’s picture

Status: Needs review » Fixed

Works fine. Committed, thanks.

  • bojanz committed 8e82006 on 7.x-1.x authored by jnicola
    Issue #1441514 by jnicola: Support Countries module for populating the...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.