You are here

function mailing_list_token_info in Mailing List 8

Implements hook_token_info().

File

./mailing_list.tokens.inc, line 17
Token related hook implementations.

Code

function mailing_list_token_info() {
  $types['mailing-list-subscription'] = [
    'name' => t('Mailing list subscription'),
    'description' => t('Tokens for mailing list subscriptions'),
    'needs-data' => 'mailing_list_subscription',
  ];

  // Basic fields.
  $tokens['sid'] = [
    'name' => t('Subscription ID'),
    'description' => t('The unique ID of the subscription.'),
  ];
  $tokens['list'] = [
    'name' => t('Mailing list ID'),
  ];
  $tokens['list-name'] = [
    'name' => t('Mailing list name'),
    'description' => t('The human-readable name of the subscriptions mailing list.'),
  ];
  $tokens['title'] = [
    'name' => t('Title'),
  ];
  $tokens['email'] = [
    'name' => t('Email'),
    'description' => t('The subscription email.'),
  ];
  $tokens['obfuscated-email'] = [
    'name' => t('Obfuscated email'),
    'description' => t("The subscription email obfuscated by replacing some characters with '*'."),
  ];
  $tokens['langcode'] = [
    'name' => t('Language code'),
    'description' => t("The subscription's language code."),
  ];
  $tokens['url'] = [
    'name' => t('URL'),
    'description' => t('The view URL of the subscription.'),
  ];
  $tokens['edit-url'] = [
    'name' => t("Edit URL"),
    'description' => t("The URL of the subscription's edit page."),
  ];
  $tokens['cancel-url'] = [
    'name' => t("Cancel URL"),
    'description' => t("The URL for subscription cancellation."),
  ];
  $tokens['unrestricted-view-url'] = [
    'name' => t('Unrestricted view URL'),
    'description' => t('A URL to view a subscription with permissions granted by an access hash.'),
  ];
  $tokens['unrestricted-edit-url'] = [
    'name' => t('Unrestricted edit URL'),
    'description' => t('A URL to edit a subscription with permissions granted by an access hash.'),
  ];
  $tokens['unrestricted-cancel-url'] = [
    'name' => t('Unrestricted cancel URL'),
    'description' => t('A URL to cancel a subscription with permissions granted by an access hash.'),
  ];
  $tokens['unrestricted-manage-url'] = [
    'name' => t('Unrestricted manage URL'),
    'description' => t('A URL to manage user subscriptions with permissions granted by an access hash.'),
  ];

  // Chained tokens for subscriptions.
  $tokens['created'] = [
    'name' => t("Date created"),
    'type' => 'date',
  ];
  $tokens['changed'] = [
    'name' => t("Date changed"),
    'description' => t("The date the subscription was most recently updated."),
    'type' => 'date',
  ];
  $tokens['owner'] = [
    'name' => t("Owner"),
    'type' => 'user',
  ];
  return [
    'types' => $types,
    'tokens' => [
      'mailing-list-subscription' => $tokens,
    ],
  ];
}