You are here

function api_tokens_example_api_tokens_info in API Tokens 7

Implements hook_api_tokens_info().

File

api_tokens_example/api_tokens_example.module, line 12
The API Tokens Example module

Code

function api_tokens_example_api_tokens_info() {

  // Token: [api:date/]
  $tokens['date'] = array(
    'title' => t('Date'),
  );

  // Token: [api:user-link/]
  $tokens['user-link'] = array(
    'title' => t('User Link'),
    'handler' => 'api_tokens_example_handle_user_link',
    'inc' => 'includes/api_tokens',
    'cache' => DRUPAL_CACHE_PER_USER,
  );

  // Token: [api:block["module", "delta"]/].
  $tokens['block'] = array(
    'title' => t('Block'),
    'description' => t('Renders a block by module name and delta.'),
  );

  // Token: [api:view["view", "display"]/]
  // OR [api:view["view", "display", [1, 2, 3]]/].
  $tokens['view'] = array(
    'title' => t('View'),
    'description' => t('Renders a view by view name and display ID.'),
  );

  // Token: [api:node-list["article"]/] OR [api:node-list/].
  $tokens['node-list'] = array(
    'title' => t('Node List'),
    'handler' => 'api_tokens_example_handle_node_list',
    'inc' => 'includes/api_tokens',
    'cache' => DRUPAL_CACHE_GLOBAL,
    // 5 minutes.
    'cache_expire' => 300,
  );
  return $tokens;
}