You are here

function _token_example_token_list in Examples for Developers 6

Implementation of hook_token_list().

1 call to _token_example_token_list()
token_example_token_list in token_example/token_example.module
Implements hook_token_list().

File

token_example/token_example.tokens.inc, line 6

Code

function _token_example_token_list($type = 'all') {
  $tokens = array();
  if ($type == 'global' || $type == 'all') {
    $tokens['global']['random-sha1'] = t("A randomly generated SHA1 hash.");
    $tokens['global']['site-date-timestamp'] = t('The current timestamp in seconds past January 1, 1970.');
    $tokens['global']['random-num-1'] = t('A randomly generated single-digit number.');
    $tokens['global']['random-num-3'] = t('A randomly generated three-digit number.');
    $tokens['global']['random-num-10'] = t('A randomly generated ten-digit number.');
    $tokens['global']['random-alpha-1'] = t('Randomly generated single-digit letter.');
    $tokens['global']['random-alpha-3'] = t('Randomly generated three-digit letters.');
    $tokens['global']['random-alpha-10'] = t('Randomly generated ten-digit letters.');
  }
  if ($type == 'node' || $type == 'all') {
    $tokens['node']['node-format'] = t('Input format used for the node body.');
    $tokens['node'] += token_get_date_token_info(t('Node revision timestamp'), 'node-revision-');

    // Node tokens here.
  }
  return $tokens;
}