8.5.x token.api.php hook_token_info_alter(&$data)
8.0.x token.api.php hook_token_info_alter(&$data)
8.1.x token.api.php hook_token_info_alter(&$data)
8.2.x token.api.php hook_token_info_alter(&$data)
8.3.x token.api.php hook_token_info_alter(&$data)
8.4.x token.api.php hook_token_info_alter(&$data)
8.6.x token.api.php hook_token_info_alter(&$data)
7.x system.api.php hook_token_info_alter(&$data)

Alter the metadata about available placeholder tokens and token types.

Parameters

$data: The associative array of token definitions from hook_token_info().

See also

hook_token_info()

Related topics

1 invocation of hook_token_info_alter()
token_info in includes/token.inc
Returns metadata describing supported tokens.

File

modules/system/system.api.php, line 4612
Hooks provided by Drupal core and the System module.

Code

function hook_token_info_alter(&$data) {

  // Modify description of node tokens for our site.
  $data['tokens']['node']['nid'] = array(
    'name' => t("Node ID"),
    'description' => t("The unique ID of the article."),
  );
  $data['tokens']['node']['title'] = array(
    'name' => t("Title"),
    'description' => t("The title of the article."),
  );

  // Chained tokens for nodes.
  $data['tokens']['node']['created'] = array(
    'name' => t("Date created"),
    'description' => t("The date the article was posted."),
    'type' => 'date',
  );
}

Comments

carinadigital’s picture

Make sure that entity tokens are enabled in order to use this hook.

Dave Reid’s picture

The entity tokens module is not required to use the hook. It's provided by core.