You are here

function uc_coupon_token_values in Ubercart Discount Coupons 5

Same name and namespace in other branches
  1. 6 uc_coupon.module \uc_coupon_token_values()

Implementation of hook_token_values().

File

uc_coupon_purchase/uc_coupon_purchase.module, line 165

Code

function uc_coupon_token_values($type, $object = NULL) {
  switch ($type) {
    case 'uc_coupon':
      $values['coupon-name'] = $object->name;
      $values['coupon-code'] = $object->code;
      if ($object->bulk) {
        $codes = array();
        for ($id = 0; $id < $object->data['bulk_number']; $id++) {
          $codes[] = uc_coupon_get_bulk_code($object, $id);
        }
        $values['coupon-bulk-codes'] .= implode("<br />", $codes);
      }
      break;
  }
  return $values;
}