You are here

function _addressfield_tokens_country in Addressfield Tokens 7

Gets the name of the country with the given abbreviation.

Parameters

string $country: The 2-letter abbreviation of the country.

Return value

string The name of the country, or FALSE.

5 calls to _addressfield_tokens_country()
addressfield_tokens_field_formatter_view in ./addressfield_tokens.module
Implements hook_field_formatter_view().
addressfield_tokens_tokens in ./addressfield_tokens.tokens.inc
Implements hook_tokens().
theme_addressfield_formatter__citystate in ./addressfield_tokens.theme.inc
Implements theme_field();
theme_addressfield_formatter__components in ./addressfield_tokens.theme.inc
theme_addressfield_formatter__linear in ./addressfield_tokens.theme.inc
Implements theme_field();

File

./addressfield_tokens.module, line 315
Main components.

Code

function _addressfield_tokens_country($country) {
  $countries = _addressfield_tokens_countries();

  // Country abbreviations will always be two uppercase letters.
  $country = drupal_strtoupper($country);
  if (!empty($country) && isset($countries[$country])) {
    return check_plain($countries[$country]);
  }
  return check_plain($country);
}