function message_example_token_info in Message 8
Same name and namespace in other branches
- 7 message_example/message_example.tokens.inc \message_example_token_info()
Implements hook_token_info().
We need this part until the token module will be exported to Drupal 8.
File
- modules/
message_example/ message_example.tokens.inc, line 13 - Place holder for the message example module.
Code
function message_example_token_info() {
$type = [
'name' => t('Message example'),
'description' => t('Tokens for the message example module.'),
'needs-data' => 'message',
];
// User relate tokens.
$message['user-name'] = [
'name' => t("Author name"),
'description' => t("The related author name."),
];
$message['user-url'] = [
'name' => t("Author url"),
'description' => t("The related author URL."),
];
// Comment relate tokens.
$message['comment-url'] = [
'name' => t("Comment url"),
'description' => t("The comment url."),
];
// Node related tokens.
$message['node-render'] = [
'name' => t("Rendered node"),
'description' => t("The related node rendered to HTML."),
];
$message['node-title'] = [
'name' => t("Node title"),
'description' => t("The related node title."),
];
$message['node-url'] = [
'name' => t("Node URL"),
'description' => t("The related node URL."),
];
return [
'types' => [
'message' => $type,
],
'tokens' => [
'message' => $message,
],
];
}