function commerce_order_token_info in Commerce Core 7
Same name and namespace in other branches
- 8.2 modules/order/commerce_order.tokens.inc \commerce_order_token_info()
Implements hook_token_info().
File
- modules/
order/ commerce_order.tokens.inc, line 12 - Builds placeholder replacement tokens for order-related data.
Code
function commerce_order_token_info() {
$type = array(
'name' => t('Orders', array(), array(
'context' => 'a drupal commerce order',
)),
'description' => t('Tokens related to individual orders.'),
'needs-data' => 'commerce-order',
);
// Tokens for orders.
$order = array();
$order['order-id'] = array(
'name' => t('Order ID', array(), array(
'context' => 'a drupal commerce order',
)),
'description' => t('The unique numeric ID of the order.'),
);
$order['order-number'] = array(
'name' => t('Order number', array(), array(
'context' => 'a drupal commerce order',
)),
'description' => t('The order number displayed to the customer.'),
);
$order['revision-id'] = array(
'name' => t('Revision ID'),
'description' => t("The unique ID of the order's latest revision."),
);
$order['type'] = array(
'name' => t('Order type'),
'description' => t('The type of the order.'),
);
$order['type-name'] = array(
'name' => t('Order type name'),
'description' => t('The human-readable name of the order type.'),
);
$order['mail'] = array(
'name' => t('Order e-mail'),
'description' => t('The e-mail address associated with the order.'),
);
$order['status'] = array(
'name' => t('Order status'),
'description' => t('The current status of the order.'),
);
$order['status-title'] = array(
'name' => t('Order status title'),
'description' => t('The human-readable title of the order status.'),
);
$order['state'] = array(
'name' => t('Order state'),
'description' => t('The current state of the order.'),
);
$order['state-title'] = array(
'name' => t('Order state title'),
'description' => t('The human-readable title of the order state.'),
);
// Chained tokens for orders.
$order['owner'] = array(
'name' => t('Owner'),
'description' => t('The owner of the order.'),
'type' => 'user',
);
$order['created'] = array(
'name' => t('Date created'),
'description' => t('The date the order was created.'),
'type' => 'date',
);
$order['changed'] = array(
'name' => t('Date changed'),
'description' => t('The date the order was last updated.'),
'type' => 'date',
);
$order['placed'] = array(
'name' => t('Date placed'),
'description' => t('The date the order was placed i.e. checkout was completed.'),
'type' => 'date',
);
return array(
'types' => array(
'commerce-order' => $type,
),
'tokens' => array(
'commerce-order' => $order,
),
);
}