function commerce_order_handler_area_order_total::render in Commerce Core 7
Render the area.
Overrides views_handler_area::render
File
- modules/
order/ includes/ views/ handlers/ commerce_order_handler_area_order_total.inc, line 78
Class
- commerce_order_handler_area_order_total
- Defines an area handler that renders an order's total field.
Code
function render($empty = FALSE) {
if (!$empty || !empty($this->options['empty'])) {
// First look for an order_id argument.
foreach ($this->view->argument as $name => $argument) {
if ($argument instanceof commerce_order_handler_argument_order_order_id) {
// If it is single value...
if (count($argument->value) == 1) {
// Load the order.
if ($order = commerce_order_load(reset($argument->value))) {
// Prepare a display settings array.
$display = array(
'label' => empty($this->options['label_display']) ? 'hidden' : $this->options['label_position'],
'type' => $this->options['formatter'],
'settings' => array(
'calculation' => FALSE,
),
);
// Render the order's order total field with the current display.
$field = field_view_field('commerce_order', $order, 'commerce_order_total', $display);
if (!empty($this->options['label_display'])) {
$field['#title'] = $this->options['label_custom'];
}
return '<div class="commerce-order-handler-area-order-total">' . drupal_render($field) . '</div>';
}
}
}
}
}
return '';
}