You are here

function privatemsg_token_info in Privatemsg 7

Same name and namespace in other branches
  1. 7.2 privatemsg.module \privatemsg_token_info()

Implements hook_token_info().

File

./privatemsg.module, line 2825
Allows users to send private messages to other users.

Code

function privatemsg_token_info() {
  $type = array(
    'name' => t('Private message'),
    'description' => t('Tokens related to private messages.'),
    'needs-data' => 'privatemsg_message',
  );

  // Tokens for private messages.
  $message['mid'] = array(
    'name' => t("Message ID"),
    'description' => t("The unique ID of the message."),
  );
  $message['thread-id'] = array(
    'name' => t("Thread ID"),
    'description' => t("The unique ID of the thread."),
  );
  $message['url'] = array(
    'name' => t("URL"),
    'description' => t("URL that points to the message."),
  );
  $message['subject'] = array(
    'name' => t("Subject"),
    'description' => t("The subject of the message."),
  );
  $message['body'] = array(
    'name' => t("Body"),
    'description' => t("The body of the message."),
  );

  // Chained tokens for nodes.
  $message['timestamp'] = array(
    'name' => t("Date created"),
    'description' => t("The date the message was sent."),
    'type' => 'date',
  );
  $message['author'] = array(
    'name' => t("Author"),
    'description' => t("The author of the message."),
    'type' => 'user',
  );
  $message['recipient'] = array(
    'name' => t("Recipient"),
    'description' => t("The recipient of the message."),
    'type' => 'user',
  );
  return array(
    'types' => array(
      'privatemsg_message' => $type,
    ),
    'tokens' => array(
      'privatemsg_message' => $message,
    ),
  );
}