function field_tokens_token_info_alter in Field tokens 7
Same name and namespace in other branches
- 8 field_tokens.tokens.inc \field_tokens_token_info_alter()
Implements hook_token_info_alter().
File
- ./
field_tokens.tokens.inc, line 70 - Token functions for Field tokens module.
Code
function field_tokens_token_info_alter(&$data) {
$token_info = _token_field_info();
foreach ($token_info as $field_name => $info) {
$field = field_info_field($field_name);
foreach ($info['token types'] as $token_type) {
if (isset($data['tokens'][$token_type])) {
// Formatted field tokens.
$data['tokens'][$token_type]["{$field_name}-formatted"] = array(
'name' => t('@label: Formatted field', array(
'@label' => $info['label'],
)),
'description' => t('The formatted value of one or more @label field values. Replace \'?\' with a comma seperated list of deltas (e.g., \'0,1\').', array(
'@label' => $info['label'],
)),
'type' => "formatted_field-{$field['type']}",
'dynamic' => TRUE,
);
// Field property tokens.
$data['tokens'][$token_type]["{$field_name}-property"] = array(
'name' => t('@label: Field properties', array(
'@label' => $info['label'],
)),
'description' => t('Field properties from one or more @label field values. Replace \'?\' with a comma seperated list of deltas (e.g., \'0,1\').', array(
'@label' => $info['label'],
)),
'type' => 'field_property',
'dynamic' => TRUE,
);
}
}
}
}