function commerce_gc_handler_field_amount::render in Commerce GC 7
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field::render
File
- includes/
views/ handlers/ commerce_gc_handler_field_amount.inc, line 35 - Provides the transaction amount field handler.
Class
- commerce_gc_handler_field_amount
- @file Provides the transaction amount field handler.
Code
function render($values) {
$value = $this
->get_value($values);
$currency_code = commerce_default_currency();
switch ($this->options['display_format']) {
case 'formatted':
return commerce_currency_format($value, $currency_code);
case 'raw':
// First load the full currency array.
$currency = commerce_currency_load($currency_code);
// Format the price as a number.
return number_format(commerce_currency_round(commerce_currency_amount_to_decimal($value, $currency_code), $currency), $currency['decimals']);
}
}