You are here

function addressfield_tokens_components in Addressfield Tokens 7

Generates token components.

Return value

mixed Array of components.

2 calls to addressfield_tokens_components()
addressfield_tokens_field_formatter_settings_form in ./addressfield_tokens.module
Implements hook_field_formatter_settings_form().
addressfield_tokens_field_formatter_settings_summary in ./addressfield_tokens.module
Implements hook_field_formatter_settings_summary().

File

./addressfield_tokens.module, line 260
Main components.

Code

function addressfield_tokens_components() {
  $comps =& drupal_static(__FUNCTION__, array());
  if (empty($comps)) {
    $names = addressfield_tokens_property_names();
    $fields = array(
      'first_name',
      'last_name',
      'name_line',
      'organisation_name',
      'thoroughfare',
      'premise',
      'locality',
      'dependent_locality',
      'administrative_area',
      'sub_administrative_area',
      'postal_code',
      'country',
    );
    foreach ($fields as $key) {
      $comps[$key] = $names[$key];
      if (in_array($key, array(
        'administrative_area',
        'country',
      ))) {
        $comps[$key . '_full'] = t('@name (full)', array(
          '@name' => $names[$key],
        ));
      }
    }
  }
  return $comps;
}