You are here

function uc_product_token_info in Ubercart 8.4

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

Implements hook_token_info().

File

uc_product/uc_product.tokens.inc, line 13
Token hooks for the uc_product module.

Code

function uc_product_token_info() {
  $node['product'] = [
    'name' => t('Product'),
    'description' => t('Ubercart product data of the node.'),
    'type' => 'uc_product',
  ];
  $types['uc_product'] = [
    'name' => t('Product'),
    'description' => t('Tokens for Ubercart products.'),
    'needs-data' => 'node',
  ];
  $product['model'] = [
    'name' => t('SKU / Model'),
    'description' => t("The product's SKU or model number."),
  ];
  $product['cost'] = [
    'name' => t('Cost'),
    'description' => t("The product's cost."),
    'type' => 'uc_price',
  ];
  $product['price'] = [
    'name' => t('Price'),
    'description' => t("The product's price."),
    'type' => 'uc_price',
  ];
  $product['weight'] = [
    'name' => t('Weight'),
    'description' => t("The product's weight."),
    'type' => 'uc_weight',
  ];
  $product['length'] = [
    'name' => t('Length'),
    'description' => t("The product's length."),
    'type' => 'uc_dimension',
  ];
  $product['width'] = [
    'name' => t('Width'),
    'description' => t("The product's width."),
    'type' => 'uc_dimension',
  ];
  $product['height'] = [
    'name' => t('Height'),
    'description' => t("The product's height."),
    'type' => 'uc_dimension',
  ];
  $types['uc_price'] = [
    'name' => t('Price'),
    'description' => 'Tokens for price formats.',
    'needs-data' => 'uc_price',
  ];
  $price['formatted'] = [
    'name' => t('Formatted'),
    'description' => t('A formatted price.'),
  ];
  $price['raw'] = [
    'name' => t('Raw value'),
    'description' => t('A decimal price.'),
  ];
  $types['uc_weight'] = [
    'name' => t('Weight'),
    'description' => 'Tokens for weight formats.',
    'needs-data' => 'uc_weight',
  ];
  $weight['formatted'] = [
    'name' => t('Formatted'),
    'description' => t('A formatted weight.'),
  ];
  $weight['raw'] = [
    'name' => t('Raw value'),
    'description' => t('A decimal weight.'),
  ];
  $weight['units'] = [
    'name' => t('Units'),
    'description' => t('The unit of measurement.'),
  ];
  $types['uc_dimension'] = [
    'name' => t('Dimension'),
    'description' => 'Tokens for length, width, and height.',
    'needs-data' => 'uc_dimension',
  ];
  $dimension['formatted'] = [
    'name' => t('Formatted'),
    'description' => t('A formatted dimension.'),
  ];
  $dimension['raw'] = [
    'name' => t('Raw value'),
    'description' => t('A decimal dimension.'),
  ];
  $dimension['units'] = [
    'name' => t('Units'),
    'description' => t('The unit of measurement.'),
  ];
  return [
    'types' => $types,
    'tokens' => [
      'node' => $node,
      'uc_product' => $product,
      'uc_price' => $price,
      'uc_weight' => $weight,
      'uc_dimension' => $dimension,
    ],
  ];
}