You are here

public function PaymentMethodPane::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

payment/uc_payment/src/Plugin/Ubercart/CheckoutPane/PaymentMethodPane.php, line 167

Class

PaymentMethodPane
Allows the user to select a payment method and preview the line items.

Namespace

Drupal\uc_payment\Plugin\Ubercart\CheckoutPane

Code

public function review(OrderInterface $order) {
  $line_items = $order
    ->getDisplayLineItems();
  foreach ($line_items as $line_item) {
    $review[] = [
      'title' => $line_item['title'],
      'data' => uc_currency_format($line_item['amount']),
    ];
  }
  $method = $this->paymentMethodManager
    ->createFromOrder($order);
  $review[] = [
    'border' => 'top',
    'title' => $this
      ->t('Paying by'),
    'data' => $method
      ->cartReviewTitle(),
  ];
  $result = $method
    ->cartReview($order);
  if (is_array($result)) {
    $review = array_merge($review, $result);
  }
  return $review;
}