function token_field_widget_form_alter in Token 7
Implements hook_widget_form_alter().
File
- ./
token.module, line 277 - Enhances the token API in core: adds a browseable UI, missing tokens, etc.
Code
function token_field_widget_form_alter(&$element, &$form_state, $context) {
if (!empty($element['#description']) && !empty($context['instance']['description'])) {
$instance = $context['instance'];
if (module_exists('i18n_field')) {
$instance = i18n_string_object_translate('field_instance', $instance);
}
$element['#description'] = field_filter_xss(token_replace($instance['description']));
}
}