You are here

function subscriptions_content_mail_edit_tokens_list in Subscriptions 6

Implementation of hook_mail_edit_tokens_list().

Provide replacable tokens for mail_edit.

2 calls to subscriptions_content_mail_edit_tokens_list()
subscriptions_content_form_mail_edit_trans_alter in ./subscriptions_content.module
Implementation of hook_form_alter().
subscriptions_taxonomy_mail_edit_tokens_list in ./subscriptions_taxonomy.module
Implementation of hook_mail_edit_tokens_list().

File

./subscriptions_content.module, line 1071
Subscriptions to content events

Code

function subscriptions_content_mail_edit_tokens_list($mailkey, $options = array()) {
  $tr = 't';
  $tokens = array();
  switch ($mailkey) {
    case 'comments':
      $tokens += array(
        '!comment_name' => t('The name of the comment author.'),
      );
      if (module_exists('realname')) {
        $tokens += array(
          '!comment_realname' => t('The real name of the comment author (provided by Realname module).'),
        );
      }
      $tokens += array(
        '!comment_uid' => t('The ID of the comment author (0 = %anonymous).', array(
          '%anonymous' => variable_get('anonymous', t('Anonymous')),
        )),
        '!comment_title' => t('The title of the comment.'),
        '!comment_text' => t('The body text of the comment.'),
        '!comment_cid' => t('The ID of the comment.'),
        '!comment_nid' => t("The ID of the comment's node."),
        '!comment_url' => t('The direct URL of the comment.'),
        '!comment_is_new' => t('The type of comment notification: 1 = new comment, 0 = updated comment.'),
        '!comment_is_published' => t('The comment publication state: 1 = published, 0 = unpublished.<br />(Unpublished comments are sent to users with the %administer_comments permission only.)', array(
          '%administer_comments' => $tr('administer comments'),
        )),
      );
      return $tokens;
    default:
      $tokens += array(
        '!unsubscribe_url' => t('The user can unsubscribe by clicking this link.'),
        '!sender_name' => t('The name of the sender (if the sender is visible).'),
      );
      if (module_exists('realname')) {
        $tokens += array(
          '!sender_realname' => t('The real name of the sender (provided by RealName module).'),
        );
      }
      $tokens += array(
        '!sender_page' => t('The user page of the sender (if the sender is visible).'),
        '!sender_has_contact_page' => t("The sender's contact setting: 1 = contact form enabled, 0 = disabled."),
        '!sender_contact_page' => t('The contact page of the sender.'),
        '!sender_uid' => t('The ID of the sender (even if the sender is not visible!) (0 = %anonymous).', array(
          '%anonymous' => variable_get('anonymous', t('Anonymous')),
        )),
        '!subs_type' => t("The type of the subscription, like '!thread' or '!category'.", array(
          '!thread' => t('thread'),
          '!category' => $tr('category'),
        )),
        '!node_type' => t("The type of the node, like '!forum' or '!story'.", array(
          '!forum' => 'forum',
          '!story' => 'story',
        )),
        '!revision_name' => t('The name of the user who made the last change to the node.'),
        '!revision_log' => t('The revision log entry of the node.'),
        '!nid' => t('The ID of the node.'),
        '!title' => t('The title of the subscriptions item.'),
        '!teaser' => t('An excerpt of the subscriptions item.'),
        '!body' => t('The body of the subscriptions item.'),
      );
      if (isset($options['tokens'])) {
        $tokens += $options['tokens'];
      }
      $tokens += module_invoke_all('subscriptions_tokens_list', $mailkey, array(
        'tokens' => $tokens,
      ));
      if ($mailkey != 'digest') {
        $tokens['!full_node'] = t('The full node as it appears on the website (must be specifically enabled !here).', array(
          '!here' => l(t('here'), 'admin/settings/subscriptions', array(
            'fragment' => 'edit-subscriptions-generate-full-node',
          )),
        ));
      }
      $tokens += array(
        '!url' => t('The URL of the item.'),
        '!is_new' => t('The type of notification: 1 = new item, 0 = otherwise.'),
        '!is_updated' => t('The type of notification: 1 = updated (possibly new and already updated) item, 0 = otherwise.'),
        '!is_old' => t('The type of notification: 1 = neither new nor updated item, 0 = otherwise.'),
        '!is_published' => t('The publication state: 1 = published, 0 = unpublished.<br />(Unpublished nodes are sent to users with the %administer_nodes permission only.)', array(
          '%administer_nodes' => $tr('administer nodes'),
        )),
        '!has_files' => t('The presence of attached files or img_assist images: 1 = files are available in !files, 0 = no files.'),
        '!files' => t('The list of attached files, one per line, if any, otherwise empty.'),
        '!has_new_comments' => t('The comments state: 1 = comments are available in !comments, 0 = no comments.'),
        '!comments' => t('One or more comments if available, otherwise empty.') . '<br />',
      );
      if ($mailkey == 'node-nid' || $mailkey == 'digest') {
        $tokens['!comments'] = $tokens['!comments'] . t('The rendering of the comments is defined by the template below.');
      }
      else {
        $tokens['!comments'] = $tokens['!comments'] . t('The rendering of the comments is defined by the !link.', array(
          '!link' => '<a href="../subscriptions_content_node-nid/' . check_plain(subscriptions_arg(4)) . '#edit-comment-body">' . t('comment templates') . '</a>',
        ));
      }
  }
  return $tokens;
}