public function OrderItemOrderTotal::render in Commerce add to cart confirmation 1.x
File
- src/
Plugin/ views/ area/ OrderItemOrderTotal.php, line 49
Class
- OrderItemOrderTotal
- Defines an order total area handler.
Namespace
Drupal\commerce_add_to_cart_confirmation\Plugin\views\areaCode
public function render($empty = FALSE) {
if (!$empty || !empty($this->options['empty'])) {
foreach ($this->view->argument as $argument) {
// First look for an order_id argument.
if (!$argument instanceof NumericArgument) {
continue;
}
if ($argument
->getField() !== 'commerce_order_item.order_item_id') {
continue;
}
/** @var \Drupal\commerce_order\Entity\OrderItemInterface $order_item */
$order_item = $this->orderItemStorage
->load($argument
->getValue());
if (!$order_item) {
continue;
}
if ($order = $order_item
->getOrder()) {
return $order
->get('total_price')
->view([
'label' => 'inline',
]);
}
}
}
return [];
}