You are here

function simplenews_token_info in Simplenews 7

Same name and namespace in other branches
  1. 8.2 simplenews.tokens.inc \simplenews_token_info()
  2. 8 simplenews.tokens.inc \simplenews_token_info()
  3. 7.2 simplenews.tokens.inc \simplenews_token_info()
  4. 3.x simplenews.tokens.inc \simplenews_token_info()

Implements hook_token_info().

File

./simplenews.tokens.inc, line 11
Token related hook implementations.

Code

function simplenews_token_info() {
  $types['simplenews-subscriber'] = array(
    'name' => t('Simplenews subscriber'),
    'description' => t('Tokens related to the newsletter recipient'),
    'needs-data' => 'simplenews_subscriber',
  );
  $types['simplenews-category'] = array(
    'name' => t('Simplenews newsletter category'),
    'description' => t('Tokens related to the newsletter category'),
    'needs-data' => 'category',
  );

  // Tokens for simplenews subscriber.
  $subscriber['subscribe-url'] = array(
    'name' => t('Subscription URL'),
    'description' => t('The URL of the page where the subscription is confirmed.'),
  );
  $subscriber['unsubscribe-url'] = array(
    'name' => t('Unsubscribe URL'),
    'description' => t('The URL of the page where the cancellation of the subscription is confirmed.'),
  );
  $subscriber['manage-url'] = array(
    'name' => t('Manage URL'),
    'description' => t('The URL of the page where the subscribers can manage their newsletter subscriptions.'),
  );
  $subscriber['combined-url'] = array(
    'name' => t('Combined confirmation URL'),
    'description' => t('The URL of the page where subscribers can confirm their subscription changes.'),
  );
  $subscriber['mail'] = array(
    'name' => t('Subscriber email'),
    'description' => t('The email address of the newsletter receiver.'),
  );
  $subscriber['user'] = array(
    'name' => t('Corresponding user'),
    'description' => t('The user object that corresponds to this subscriber. This is not set for anonymous subscribers.'),
    'type' => 'user',
  );

  // Tokens for simplenews newsletter category.
  $category['name'] = array(
    'name' => t('Newsletter category'),
    'description' => t('The name of the newsletter category.'),
  );
  $category['url'] = array(
    'name' => t('Newsletter category URL'),
    'description' => t('The URL of the page listing the issues of this newsletter category.'),
  );
  $category['term'] = array(
    'name' => t('Corresponding term'),
    'description' => t('The taxonomy term of this newsletter category'),
    'type' => 'term',
  );
  return array(
    'types' => $types,
    'tokens' => array(
      'simplenews-subscriber' => $subscriber,
      'simplenews-category' => $category,
    ),
  );
}