You are here

function uc_order_token_info in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 uc_order/uc_order.tokens.inc \uc_order_token_info()

Implements hook_token_info().

File

uc_order/uc_order.tokens.inc, line 17
Token hooks for the uc_order module.

Code

function uc_order_token_info() {
  $types = [
    'name' => t('Orders'),
    'description' => t('Tokens related to Ubercart orders.'),
    'needs-data' => 'uc_order',
  ];
  $tokens = [];
  $tokens['new-username'] = [
    'name' => t('New username'),
    'description' => t('New username associated with an order if applicable.'),
  ];
  $tokens['new-password'] = [
    'name' => t('New password'),
    'description' => t('New password associated with an order if applicable.'),
  ];
  $tokens['order-number'] = [
    'name' => t('Order number'),
    'description' => t('The unique identifier of the order.'),
  ];
  $tokens['url'] = [
    'name' => t('URL'),
    'description' => t('The URL to the order'),
    'type' => 'url',
  ];
  $tokens['link'] = [
    'name' => t('Link'),
    'description' => t('A link to the order using the order ID.'),
  ];
  $tokens['admin-url'] = [
    'name' => t('Admin URL'),
    'description' => t('The URL to the admin view page using the order ID.'),
    'type' => 'url',
  ];
  $tokens['admin-link'] = [
    'name' => t('Admin link'),
    'description' => t('A link to the order admin view page using the order ID.'),
  ];
  $tokens['subtotal'] = [
    'name' => t('Subtotal'),
    'description' => t('The subtotal of products on an order.'),
  ];
  $tokens['total'] = [
    'name' => t('Total'),
    'description' => t('The order total.'),
  ];
  $tokens['email'] = [
    'name' => t('Email'),
    'description' => t('The primary e-mail address of the order.'),
  ];

  // Duplicate the [uc_order:email] token as [uc_order:mail] because the Views
  // Bulk Operations module validates tokens ending in :mail.
  $tokens['mail'] = $tokens['email'];
  $tokens['shipping-method'] = [
    'name' => t('Shipping method'),
    'description' => t('The title of the first shipping line item.'),
  ];
  $tokens['shipping-address'] = [
    'name' => t('Shipping address'),
    'description' => t('The order shipping address.'),
  ];
  $tokens['shipping-phone'] = [
    'name' => t('Shipping phone number'),
    'description' => t('The phone number for the shipping address.'),
  ];
  $tokens['billing-address'] = [
    'name' => t('Billing address'),
    'description' => t('The order billing address.'),
  ];
  $tokens['billing-phone'] = [
    'name' => t('Billing phone number'),
    'description' => t('The phone number for the billing address.'),
  ];
  $tokens['first-name'] = [
    'name' => t("Customer's first name"),
    'description' => t('The first name associated with the order.'),
  ];
  $tokens['last-name'] = [
    'name' => t("Customer's last name"),
    'description' => t('The last name associated with the order.'),
  ];
  $tokens['comments'] = [
    'name' => t('Comments'),
    'description' => t('Comments left by the customer.'),
  ];
  $tokens['last-comment'] = [
    'name' => t('Last comment'),
    'description' => t('Last order comment left by an administrator (not counting the order admin comments).'),
  ];
  $tokens['order-status'] = [
    'name' => t('Order status'),
    'description' => t('The current order status.'),
  ];
  $tokens['customer'] = [
    'name' => t('Customer'),
    'description' => t('The user associated with the order.'),
    'type' => 'user',
  ];
  $tokens['created'] = [
    'name' => t('Date created'),
    'description' => t('The date and time when the order was created.'),
    'type' => 'date',
  ];
  $tokens['changed'] = [
    'name' => t('Date changed'),
    'description' => t('The date the order was most recently updated.'),
    'type' => 'date',
  ];
  $tokens['products'] = [
    'name' => t('Products'),
    'description' => t('A list of products in the order.'),
  ];
  return [
    'types' => [
      'uc_order' => $types,
    ],
    'tokens' => [
      'uc_order' => $tokens,
    ],
  ];
}