You are here

function getlocations_fields_token_info in Get Locations 7.2

Same name and namespace in other branches
  1. 7 modules/getlocations_fields/getlocations_fields.functions.inc \getlocations_fields_token_info()

Implements hook_token_info(). derived from location_cck module

File

modules/getlocations_fields/getlocations_fields.functions.inc, line 718
getlocations_fields.functions.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_fields_token_info() {
  $module = 'getlocations_fields';
  $supported_entities = getlocations_get_supported_entities($module);
  $columns = getlocations_fields_columns();
  $info = array();
  $fields = field_info_field_map();

  // Loop over the entities and fields and setup tokens.
  foreach ($fields as $field_key => $field_value) {
    if ($field_value['type'] == $module) {
      foreach ($supported_entities as $entity) {
        $info['types'][$field_key] = array(
          'name' => t('GetLocations fields: !field', array(
            '!field' => $field_key,
          )),
          'description' => t('Tokens for the field: !field. Replace the "?" with the delta you want. Defaults to delta 0..', array(
            '!field' => $field_key,
          )),
          'needs-data' => $entity,
        );
        $info['tokens'][$entity][$field_key] = array(
          'name' => t('GetLocations field: !field', array(
            '!field' => $field_key,
          )),
          'description' => t('Tokens for the field: !field. Replace the "?" with the delta you want. Defaults to delta 0.', array(
            '!field' => $field_key,
          )),
          'type' => $field_key,
        );
      }
      foreach ($columns as $col_key => $col_value) {
        $info['tokens'][$field_key][$col_key . ":?"] = array(
          'name' => t($col_value),
          'description' => t($col_value),
          'type' => $field_key,
        );
      }
    }
  }
  return $info;
}