You are here

function commerce_coupon_handler_field_coupon_granted_amount::render in Commerce Coupon 7

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field::render

File

includes/views/handlers/commerce_coupon_handler_field_coupon_granted_amount.inc, line 20
Displays the granted amount of a coupon based in each coupon type conditions.

Class

commerce_coupon_handler_field_coupon_granted_amount
@file Displays the granted amount of a coupon based in each coupon type conditions.

Code

function render($values) {
  $amount = '';

  // Get the coupon & order from the entities returned by the view.
  $coupons = $this->view->query
    ->get_result_entities(array(
    $values,
  ));
  $coupon = reset($coupons[1]);
  list(, $orders) = $this->query
    ->get_result_entities(array(
    $values,
  ), 'commerce_coupon_order_reference_commerce_coupon');
  $order = reset($orders);
  drupal_alter('commerce_coupon_granted_amount', $amount, $coupon, $order);
  return $amount;
}