You are here

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

uc_cart/src/Plugin/Ubercart/CheckoutPane/OrderCommentsPane.php, line 59

Class

OrderCommentsPane
Allows a customer to make comments on the order.

Namespace

Drupal\uc_cart\Plugin\Ubercart\CheckoutPane

Code

public function review(OrderInterface $order) {
  $review = NULL;
  $result = \Drupal::database()
    ->query('SELECT message FROM {uc_order_comments} WHERE order_id = :id', [
    ':id' => $order
      ->id(),
  ]);
  if ($comment = $result
    ->fetchObject()) {
    $review[] = [
      'title' => $this
        ->t('Comment'),
      'data' => [
        '#markup' => $comment->message,
      ],
    ];
  }
  return $review;
}