annotate vendor/chi-teck/drupal-code-generator/templates/d7/hook/token_info.twig @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents c75dbcec494b
children
rev   line source
Chris@0 1 /**
Chris@0 2 * Implements hook_token_info().
Chris@0 3 */
Chris@0 4 function {{ machine_name }}_token_info() {
Chris@0 5 $type = array(
Chris@0 6 'name' => t('Nodes'),
Chris@0 7 'description' => t('Tokens related to individual nodes.'),
Chris@0 8 'needs-data' => 'node',
Chris@0 9 );
Chris@0 10
Chris@0 11 // Core tokens for nodes.
Chris@0 12 $node['nid'] = array(
Chris@0 13 'name' => t("Node ID"),
Chris@0 14 'description' => t("The unique ID of the node."),
Chris@0 15 );
Chris@0 16 $node['title'] = array(
Chris@0 17 'name' => t("Title"),
Chris@0 18 'description' => t("The title of the node."),
Chris@0 19 );
Chris@0 20 $node['edit-url'] = array(
Chris@0 21 'name' => t("Edit URL"),
Chris@0 22 'description' => t("The URL of the node's edit page."),
Chris@0 23 );
Chris@0 24
Chris@0 25 // Chained tokens for nodes.
Chris@0 26 $node['created'] = array(
Chris@0 27 'name' => t("Date created"),
Chris@0 28 'description' => t("The date the node was posted."),
Chris@0 29 'type' => 'date',
Chris@0 30 );
Chris@0 31 $node['author'] = array(
Chris@0 32 'name' => t("Author"),
Chris@0 33 'description' => t("The author of the node."),
Chris@0 34 'type' => 'user',
Chris@0 35 );
Chris@0 36
Chris@0 37 return array(
Chris@0 38 'types' => array('node' => $type),
Chris@0 39 'tokens' => array('node' => $node),
Chris@0 40 );
Chris@0 41 }