function private_message_token_info in Private Message 8
Same name and namespace in other branches
- 8.2 private_message.tokens.inc \private_message_token_info()
Implements hook_token_info().
File
- ./
private_message.tokens.inc, line 17 - Provides tokens for the Private Message module.
Code
function private_message_token_info() {
// Defined the private message token type.
$private_message_type = [
'name' => t('Private Messages'),
'description' => t('Tokens related to private messages'),
'needs-data' => 'private_message',
];
// Define the private message thread token type.
$private_message_thread_type = [
'name' => t('Private Message Threads'),
'description' => t('Tokens related to private message threads'),
'needs-data' => 'private_message_thread',
];
// Define private message tokens.
$private_message_tokens['id'] = [
'name' => t('ID'),
'description' => t('The ID of the private message'),
];
$private_message_tokens['message'] = [
'name' => t('Message'),
'description' => t('The raw body of the private message'),
];
$private_message_tokens['author-name'] = [
'name' => t('Author'),
'description' => t('The author of the private message'),
];
$private_message_tokens['url'] = [
'name' => t('Url'),
'description' => t('The URL of the individual private message. Use the URL token of the private message thread to link to the conversation'),
];
$private_message_tokens['created'] = [
'name' => t('Creation date'),
'description' => t('The date at which the message was posted'),
'type' => 'date',
];
// Define private message thread tokens.
$private_message_thread_tokens['id'] = [
'name' => t('ID'),
'description' => t('The ID of the private message thread'),
];
$private_message_thread_tokens['url'] = [
'name' => t('URL'),
'description' => t('The link to the private message thread'),
];
$private_message_thread_tokens['updated'] = [
'name' => t('Last update'),
'description' => t('The date at which the thread was last updated'),
'type' => 'date',
];
return [
'types' => [
'private_message' => $private_message_type,
'private_message_thread' => $private_message_thread_type,
],
'tokens' => [
'private_message' => $private_message_tokens,
'private_message_thread' => $private_message_thread_tokens,
],
];
}