You are here

function token_field_info_alter in Token 7

Same name and namespace in other branches
  1. 8 token.module \token_field_info_alter()

Implements hook_field_info_alter().

File

./token.module, line 290
Enhances the token API in core: adds a browseable UI, missing tokens, etc.

Code

function token_field_info_alter(&$info) {
  $defaults = array(
    'taxonomy_term_reference' => 'taxonomy_term_reference_plain',
    'number_integer' => 'number_unformatted',
    'number_decimal' => 'number_unformatted',
    'number_float' => 'number_unformatted',
    'file' => 'file_url_plain',
    'image' => 'file_url_plain',
    'text' => 'text_default',
    'text_long' => 'text_default',
    'text_with_summary' => 'text_default',
    'list_integer' => 'list_default',
    'list_float' => 'list_default',
    'list_text' => 'list_default',
    'list_boolean' => 'list_default',
  );
  foreach ($defaults as $field_type => $default_token_formatter) {
    if (isset($info[$field_type])) {
      $info[$field_type] += array(
        'default_token_formatter' => $default_token_formatter,
      );
    }
  }
}