You are here

function uc_product_token_values in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_product/uc_product.module \uc_product_token_values()

Implements hook_token_values().

File

uc_product/uc_product.module, line 1024
The product module for Ubercart.

Code

function uc_product_token_values($type, $object = NULL, $options = array()) {
  if ($type == 'node' && uc_product_is_product($object)) {
    $tokens = array();
    $tokens['model'] = $object->model;
    $tokens['list_price'] = $object->list_price;
    $tokens['cost'] = $object->cost;
    $tokens['sell_price'] = $object->sell_price;
    $tokens['weight_units'] = $object->weight_units;
    $tokens['weight-raw'] = $object->weight;
    $tokens['weight'] = uc_weight_format($object->weight, $object->weight_units);
    $tokens['length_units'] = $object->length_units;
    $tokens['length-raw'] = $object->length;
    $tokens['length'] = uc_length_format($object->length, $object->length_units);
    $tokens['width-raw'] = $object->width;
    $tokens['width'] = uc_length_format($object->width, $object->length_units);
    $tokens['height-raw'] = $object->height;
    $tokens['height'] = uc_length_format($object->height, $object->length_units);
    return $tokens;
  }
}