function commerce_line_item_token_info in Commerce Core 7
Implements hook_token_info().
File
- modules/
line_item/ commerce_line_item.tokens.inc, line 12 - Builds placeholder replacement tokens for line item related data.
Code
function commerce_line_item_token_info() {
$type = array(
'name' => t('Line items'),
'description' => t('Tokens related to individual line items.'),
'needs-data' => 'commerce-line-item',
);
// Tokens for line items.
$line_item = array();
$line_item['line-item-id'] = array(
'name' => t('Line item ID'),
'description' => t('The unique numeric ID of the line item.'),
);
$line_item['type'] = array(
'name' => t('Line item type'),
'description' => t('The type of the line item.'),
);
$line_item['type-name'] = array(
'name' => t('Line item type name'),
'description' => t('The human-readable name of the line item type.'),
);
$line_item['line-item-label'] = array(
'name' => t('Line item label'),
'description' => t('The label displayed with the line item.'),
);
$line_item['quantity'] = array(
'name' => t('Quantity'),
'description' => t('The quantity of the line item.'),
);
// Chained tokens for products.
$line_item['order'] = array(
'name' => t('Order'),
'description' => t('Order associated with the line item'),
'type' => 'commerce-order',
);
$line_item['created'] = array(
'name' => t('Date created'),
'description' => t('The date the line item was created.'),
'type' => 'date',
);
$line_item['changed'] = array(
'name' => t('Date updated'),
'description' => t('The date the line item was last updated.'),
'type' => 'date',
);
return array(
'types' => array(
'commerce-line-item' => $type,
),
'tokens' => array(
'commerce-line-item' => $line_item,
),
);
}