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
Related topics
- Hooks
- Define functions that alter the behavior of Drupal core.
File
- core/lib/Drupal/Core/Utility/token.api.php, line 265
- Hooks related to the Token system.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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' , ); } |
Please login to continue.