public function LineItems::view in Ubercart 8.4
Returns the contents of an order pane as a store administrator.
Parameters
\Drupal\uc_order\OrderInterface $order: The order that is being viewed.
string $view_mode: The view mode that is being used to render the order.
Return value
array A render array showing order data.
Overrides OrderPanePluginInterface::view
File
- uc_order/
src/ Plugin/ Ubercart/ OrderPane/ LineItems.php, line 40
Class
- LineItems
- View and modify an order's line items.
Namespace
Drupal\uc_order\Plugin\Ubercart\OrderPaneCode
public function view(OrderInterface $order, $view_mode) {
$rows = [];
foreach ($order
->getDisplayLineItems() as $item) {
$rows[] = [
'data' => [
// Title column.
[
'data' => [
'#markup' => $item['title'],
],
'class' => [
'li-title',
],
],
// Amount column.
[
'data' => [
'#theme' => 'uc_price',
'#price' => $item['amount'],
],
'class' => [
'li-amount',
],
],
],
];
}
$build['line_items'] = [
'#type' => 'table',
'#rows' => $rows,
'#attributes' => [
'class' => [
'line-item-table',
],
],
];
return $build;
}