You are here

public function CustomerInfo::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/CustomerInfo.php, line 31

Class

CustomerInfo
Manage the information for the customer's user account.

Namespace

Drupal\uc_order\Plugin\Ubercart\OrderPane

Code

public function view(OrderInterface $order, $view_mode) {
  if ($view_mode != 'customer') {
    if ($order
      ->getOwnerId()) {
      $build['uid'] = [
        '#type' => 'link',
        '#prefix' => $this
          ->t('Customer number') . ': ',
        '#suffix' => '<br />',
        '#title' => $order
          ->getOwnerId(),
        '#url' => $order
          ->getOwner()
          ->toUrl(),
      ];
    }
    $build['primary_email'] = [
      '#type' => 'link',
      '#prefix' => $this
        ->t('E-mail address') . ': ',
      '#title' => $order
        ->getEmail(),
      '#url' => Url::fromUri('mailto:' . $order
        ->getEmail()),
    ];
    return $build;
  }
}