function commerce_product_token_info in Commerce Core 7
Implements hook_token_info().
File
- modules/
product/ commerce_product.tokens.inc, line 12 - Builds placeholder replacement tokens for product-related data.
Code
function commerce_product_token_info() {
$type = array(
'name' => t('Products'),
'description' => t('Tokens related to individual products.'),
'needs-data' => 'commerce-product',
);
// Tokens for products.
$product = array();
$product['product-id'] = array(
'name' => t('Product ID'),
'description' => t('The internal numeric ID of the product.'),
);
$product['sku'] = array(
'name' => t('SKU'),
'description' => t('The human readable product SKU.'),
);
$product['type'] = array(
'name' => t('Type'),
'description' => t('The machine name of the product type.'),
);
$product['type-name'] = array(
'name' => t('Type name'),
'description' => t('The human readable name of the product type.'),
);
$product['title'] = array(
'name' => t('Title'),
'description' => t('The title of the product.'),
);
// Chained tokens for products.
$product['creator'] = array(
'name' => t('Creator'),
'description' => t('The creator of the product.'),
'type' => 'user',
);
$product['created'] = array(
'name' => t('Date created'),
'description' => t('The date the product was created.'),
'type' => 'date',
);
$product['changed'] = array(
'name' => t('Date updated'),
'description' => t('The date the product was last updated.'),
'type' => 'date',
);
return array(
'types' => array(
'commerce-product' => $type,
),
'tokens' => array(
'commerce-product' => $product,
),
);
}