You are here

function getlocations_get_country_id in Get Locations 7

Same name and namespace in other branches
  1. 7.2 getlocations.module \getlocations_get_country_id()

Get the two letter code for a country

Parameters

string $country Full country name.:

Return value

string The two letter iso code of a country

3 calls to getlocations_get_country_id()
getlocations_feeds_set_country in modules/getlocations_feeds/getlocations_feeds.module
Set the country and attempt to support non-iso country imports
getlocations_fields_handler_field_country::render in modules/getlocations_fields/handlers/getlocations_fields_handler_field_country.inc
Render the field.
getlocations_location_taxonomize_fixup in modules/getlocations_location_taxonomize/getlocations_location_taxonomize.inc
Fixup the country name and province name fields

File

./getlocations.module, line 5900
getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_get_country_id($country) {
  $id = FALSE;
  $countries = getlocations_get_countries_list();
  foreach ($countries as $k => $v) {
    if (drupal_strtoupper($country) == drupal_strtoupper($v)) {
      $id = drupal_strtoupper($k);
      break;
    }
  }
  return $id;
}