function addressfield_token_info in Address Field 7
Implements hook_token_info().
File
- ./
addressfield.tokens.inc, line 11 - Token module integration.
Code
function addressfield_token_info() {
$type = array(
'name' => t('Address field'),
'description' => t('Tokens related to address field values and their components.'),
'needs-data' => 'address-field',
'field' => TRUE,
);
// Define tokens for the various components of addresses supported through the
// user interface along with two helper tokens for country and administrative
// area to distinguish between names and abbreviations.
$info['country'] = array(
'name' => t('Country name'),
'description' => t('The full name of the country.'),
);
$info['country-code'] = array(
'name' => t('Country code'),
'description' => t('The two letter ISO country code.'),
);
$info['administrative-area'] = array(
'name' => t('Administrative area (i.e. State/Province)'),
'description' => t('The administrative area value, expanded to the full name if applicable.'),
);
$info['administrative-area-raw'] = array(
'name' => t('Administrative area (raw value)'),
'description' => t('The raw administrative area value.'),
);
$info['locality'] = array(
'name' => t('Locality (i.e. City)'),
'description' => t('The locality value.'),
);
$info['postal-code'] = array(
'name' => t('Postal code'),
'description' => t('The postal code value.'),
);
$info['thoroughfare'] = array(
'name' => t('Thoroughfare (i.e. Street address)'),
'description' => t('The thoroughfare value.'),
);
$info['premise'] = array(
'name' => t('Premise (i.e. Street address)'),
'description' => t('The premise value.'),
);
$info['sub_premise'] = array(
'name' => t('Sub Premise (i.e. Suite, Apartment, Floor, Unknown.)'),
'description' => t('The sub premise value.'),
);
$info['organisation'] = array(
'name' => t('Organisation'),
'description' => t('The organisation name value.'),
);
$info['name-line'] = array(
'name' => t('Full name'),
'description' => t('The name line value of the address.'),
);
$info['first-name'] = array(
'name' => t('First name'),
'description' => t('The first name value.'),
);
$info['last-name'] = array(
'name' => t('Last name'),
'description' => t('The last name value.'),
);
// Add a helper token to format addresses as expected by MailChimp.
$info['format-mailchimp'] = array(
'name' => t('Address formatted for MailChimp'),
'description' => t('The full address formatted for import into MailChimp.'),
);
return array(
'types' => array(
'address-field' => $type,
),
'tokens' => array(
'address-field' => $info,
),
);
}