You are here

function commerce_gc_handler_field_balance_summary::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_balance_summary.inc, line 20
Provides a balance summary field for giftcards

Class

commerce_gc_handler_field_balance_summary
@file Provides a balance summary field for giftcards

Code

function render($values) {
  $coupon = commerce_coupon_load($this
    ->get_value($values, 'coupon_id'));
  if ($coupon) {
    $balance = commerce_gc_giftcard_balance($coupon->coupon_id);
    $output = t('Balance: @balance', array(
      '@balance' => commerce_currency_format($balance, commerce_default_currency()),
    )) . '<br/>' . l(t('Transactions'), 'giftcards/' . $coupon->coupon_id . '/transactions');
    return $output;
  }
}