node_token_info()
Implements hook_token_info().
File
- core/modules/node/node.tokens.inc, line 16
- Builds placeholder replacement tokens for node-related data.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | function node_token_info() { $type = array ( 'name' => t( 'Nodes' ), 'description' => t( 'Tokens related to individual content items, or "nodes".' ), 'needs-data' => 'node' , ); // Core tokens for nodes. $node [ 'nid' ] = array ( 'name' => t( "Content ID" ), 'description' => t( 'The unique ID of the content item, or "node".' ), ); $node [ 'vid' ] = array ( 'name' => t( "Revision ID" ), 'description' => t( "The unique ID of the node's latest revision." ), ); $node [ 'type' ] = array ( 'name' => t( "Content type" ), ); $node [ 'type-name' ] = array ( 'name' => t( "Content type name" ), 'description' => t( "The human-readable name of the node type." ), ); $node [ 'title' ] = array ( 'name' => t( "Title" ), ); $node [ 'body' ] = array ( 'name' => t( "Body" ), 'description' => t( "The main body text of the node." ), ); $node [ 'summary' ] = array ( 'name' => t( "Summary" ), 'description' => t( "The summary of the node's main body text." ), ); $node [ 'langcode' ] = array ( 'name' => t( 'Language code' ), 'description' => t( 'The language code of the language the node is written in.' ), ); $node [ 'url' ] = array ( 'name' => t( "URL" ), 'description' => t( "The URL of the node." ), ); $node [ 'edit-url' ] = array ( 'name' => t( "Edit URL" ), 'description' => t( "The URL of the node's edit page." ), ); // Chained tokens for nodes. $node [ 'created' ] = array ( 'name' => t( "Date created" ), 'type' => 'date' , ); $node [ 'changed' ] = array ( 'name' => t( "Date changed" ), 'description' => t( "The date the node was most recently updated." ), 'type' => 'date' , ); $node [ 'author' ] = array ( 'name' => t( "Author" ), 'type' => 'user' , ); return array ( 'types' => array ( 'node' => $type ), 'tokens' => array ( 'node' => $node ), ); } |
Please login to continue.