function addressfield_token_info_alter in Address Field 7
Implements hook_token_info_alter().
File
- ./
addressfield.tokens.inc, line 90 - Token module integration.
Code
function addressfield_token_info_alter(&$data) {
// Loop over every address field on the site.
foreach (addressfield_get_address_fields() as $field_name => $field) {
foreach ($data['tokens'] as $group => $token) {
foreach (array(
$field_name,
strtr($field_name, '_', '-'),
) as $name) {
if (!isset($data['tokens'][$group][$name]) || !is_array($data['tokens'][$group][$name])) {
continue;
}
// Set the token type for the field to use the addressfield child tokens.
$data['tokens'][$group][$name]['type'] = 'address-field';
}
}
}
}