Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
function hook_token_info_alter(&$data) {
// Modify description of node tokens for our site.
$node['nid'] = array(
'name' => t("Node ID"),
'description' => t("The unique ID of the article."),
);
$node['title'] = array(
'name' => t("Title"),
'description' => t("The title of the article."),
);
// Chained tokens for nodes.
$node['created'] = array(
'name' => t("Date created"),
'description' => t("The date the article was posted."),
'type' => 'date',
);
}
Notice that the parameter by reference $data is never actually altered.
Comment | File | Size | Author |
---|---|---|---|
#1 | 734944-hook_token_info_alter-D7.patch | 1.03 KB | Dave Reid |
Comments
Comment #1
Dave ReidComment #2
Dave ReidComment #3
Dave ReidAdding novice tag
Comment #4
Dries CreditAttribution: Dries commentedYep. Committed to CVS HEAD. Thanks Dave.