You are here

function message_token_info in Message 8

Implements hook_token_info().

File

./message.tokens.inc, line 14
Builds placeholder replacement tokens for message-related data.

Code

function message_token_info() {
  $type = [
    'name' => t('messages'),
    'description' => t('Tokens related to individual content items, or "messages".'),
    'needs-data' => 'message',
  ];

  // Core tokens for messages.
  $message['mid'] = [
    'name' => t("Message ID"),
    'description' => t('The unique ID of the message.'),
  ];
  $message['template'] = [
    'name' => t("Message template"),
  ];
  $message['template-name'] = [
    'name' => t("message template name"),
    'description' => t("The human-readable name of the message template."),
  ];
  $message['uuid'] = [
    'name' => t("Message UID"),
    'description' => t("The message UUID."),
  ];
  $message['created'] = [
    'name' => t("Date created"),
    'type' => 'date',
  ];
  $message['author'] = [
    'name' => t("Author"),
    'type' => 'user',
  ];
  return [
    'types' => [
      'message' => $type,
    ],
    'tokens' => [
      'message' => $message,
    ],
  ];
}