You are here

public function QuotePane::review in Ubercart 8.4

Returns the review contents of a checkout pane.

Parameters

\Drupal\uc_order\OrderInterface $order: The order that is being processed.

Return value

array A checkout review array. Each item contains contains "title" and "data" keys which have HTML to be displayed on the checkout review page.

Overrides CheckoutPanePluginInterface::review

File

shipping/uc_quote/src/Plugin/Ubercart/CheckoutPane/QuotePane.php, line 148

Class

QuotePane
Shipping quote checkout pane plugin.

Namespace

Drupal\uc_quote\Plugin\Ubercart\CheckoutPane

Code

public function review(OrderInterface $order) {
  $review = [];
  $result = \Drupal::database()
    ->query("SELECT * FROM {uc_order_line_items} WHERE order_id = :id AND type = :type", [
    ':id' => $order
      ->id(),
    ':type' => 'shipping',
  ]);
  if ($line_item = $result
    ->fetchAssoc()) {
    $review[] = [
      'title' => $line_item['title'],
      'data' => [
        '#theme' => 'uc_price',
        '#price' => $line_item['amount'],
      ],
    ];
  }
  return $review;
}