You are here

function commerce_payment_handler_area_totals::get_value in Commerce Core 7

Get a value used for rendering.

Parameters

$values: An object containing all retrieved values.

$field: Optional name of the field where the value is stored.

1 call to commerce_payment_handler_area_totals::get_value()
commerce_payment_handler_area_totals::render in modules/payment/includes/views/handlers/commerce_payment_handler_area_totals.inc
Render the area.

File

modules/payment/includes/views/handlers/commerce_payment_handler_area_totals.inc, line 46

Class

commerce_payment_handler_area_totals
Defines a handler area that provides payment totals, the order balance, and a form to add new payments.

Code

function get_value($values, $field = NULL) {

  // In this case, a field is required.
  if (!isset($field)) {
    return;
  }

  // Prepare the proper aliases for finding data in the result set.
  $aliases = array(
    'status' => $this->view->query->fields['commerce_payment_transaction_status']['alias'],
    'currency_code' => $this->view->query->fields['commerce_payment_transaction_currency_code']['alias'],
    'amount' => $this->view->query->fields['commerce_payment_transaction_amount']['alias'],
  );
  $alias = $aliases[$field];
  if (isset($values->{$alias})) {
    return $values->{$alias};
  }
}