function fillpdf_token_token_info in FillPDF 7
Same name and namespace in other branches
- 7.2 modules/fillpdf_token/fillpdf_token.module \fillpdf_token_token_info()
Implements hook_token_info().
1 call to fillpdf_token_token_info()
- fillpdf_token_tokens in modules/
fillpdf_token/ fillpdf_token.module - Implements hook_tokens().
File
- modules/
fillpdf_token/ fillpdf_token.module, line 18 - Provides additional tokens for use in FillPDF mappings.
Code
function fillpdf_token_token_info() {
$token_info = $types = $tokens = array();
if (module_exists('uc_order')) {
$ubercart_tokens = uc_order_token_info();
// Don't add our tokens if this functionality has been added to Ubercart,
// to avoid user confusion.
if (!isset($ubercart_tokens['types']['uc_order_product'])) {
$types = array(
'name' => t('Ordered products'),
'description' => t('Tokens related to ordered products in Ubercart.'),
'needs-data' => 'uc_order_product',
);
$tokens = array();
$tokens['order-product-id'] = array(
'name' => 'Ordered product ID',
'description' => 'The unique identifier that ties the product, as configured, to its order.',
);
$tokens['order'] = array(
'name' => t('Order'),
'description' => t('The order to which this ordered product belongs.'),
'type' => 'uc_order',
);
$tokens['title'] = array(
'name' => t('Title'),
'description' => t('The title of the ordered product.'),
);
$tokens['model'] = array(
'name' => t('Model/SKU'),
'description' => t('The model/SKU that was ordered.'),
);
$tokens['qty'] = array(
'name' => t('Quantity'),
'description' => t('The quantity ordered.'),
);
$tokens['cost'] = array(
'name' => t('Cost'),
'description' => t('The cost (not price) of this product.'),
);
$tokens['price'] = array(
'name' => t('Price'),
'description' => t('The price (not cost) of this product.'),
);
$tokens['weight'] = array(
'name' => t('Weight'),
'description' => t('The product weight without units.'),
);
$tokens['weight-units'] = array(
'name' => t('Weight units'),
'description' => t('The weight unit (for example, lb) that the numerical weight represents.'),
);
$tokens['attributes:?'] = array(
'name' => t('Ordered attributes'),
'description' => t('An attribute with which the product was ordered. Replace the ? with the name of your attribute, with hyphens (-) instead of spaces, as displayed on <a href="!attributes_page">the Attributes overview</a>. Example: <em>[uc-order-product:attributes:Favorite-pet-name]</em>. NOTE: Only tested with text fields. Does not support multiple attribute values; only prints the first value.', array(
'!attributes_page' => url('admin/store/products/attributes'),
)),
);
}
}
return array(
'types' => array(
'uc_order_product' => $types,
),
'tokens' => array(
'uc_order_product' => $tokens,
),
);
}