You are here

function basic_cart_order_tokens_format in Basic cart 8.3

Same name and namespace in other branches
  1. 8.6 basic_cart.module \basic_cart_order_tokens_format()
  2. 8 basic_cart.module \basic_cart_order_tokens_format()
  3. 8.0 basic_cart.module \basic_cart_order_tokens_format()
  4. 8.2 basic_cart.module \basic_cart_order_tokens_format()
  5. 8.4 basic_cart.module \basic_cart_order_tokens_format()
  6. 8.5 basic_cart.module \basic_cart_order_tokens_format()
  7. 7.3 basic_cart_order/basic_cart_order.module \basic_cart_order_tokens_format()

Callback function for formatting the order tokens.

Parameters

array $tokens: The tockens list.

Return value

array The formatted list of tokens

1 string reference to 'basic_cart_order_tokens_format'
basic_cart_order_send_notifications in ./basic_cart.module
Sending emails.

File

./basic_cart.module, line 239
Basic cart module file.

Code

function basic_cart_order_tokens_format(array &$tokens) {
  $utility = new Utility();
  if (is_array($tokens) && count($tokens) > 0) {
    foreach ($tokens as $token => $value) {
      switch ($token) {
        case '[basic_cart_order:basic_cart_total_price]':
          $tokens[$token] = $utility::formatPrice($value
            ->__toString());
          break;
        case '[basic_cart_order:basic_cart_vat]':
          $tokens[$token] = $utility::formatPrice($value
            ->__toString());
          break;
      }
    }
  }
  return $tokens;
}