You are here

function addressfield_tokens_state in Addressfield Tokens 7

Gets the name of the state with the given abbreviation.

Parameters

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

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

Return value

string The name of the state, or FALSE.

3 calls to addressfield_tokens_state()
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__components in ./addressfield_tokens.theme.inc

File

./addressfield_tokens.module, line 390
Main components.

Code

function addressfield_tokens_state($country, $state) {
  $states = addressfield_tokens_states($country);

  // State abbreviations will usually be two uppercase letters.
  $state_upper = drupal_strtoupper($state);
  if (!empty($state_upper) && !empty($states[$state_upper])) {
    return check_plain($states[$state]);
  }
  return check_plain($state);
}