You are here

public function OrderController::invoice in Ubercart 8.4

Displays an order invoice.

Parameters

\Drupal\uc_order\OrderInterface $uc_order: The order entity.

bool $print: Whether to generate a printable version.

Return value

array|string A render array or HTML markup in a form suitable for printing.

1 string reference to 'OrderController::invoice'
uc_order.routing.yml in uc_order/uc_order.routing.yml
uc_order/uc_order.routing.yml

File

uc_order/src/Controller/OrderController.php, line 46

Class

OrderController
Controller routines for order routes.

Namespace

Drupal\uc_order\Controller

Code

public function invoice(OrderInterface $uc_order, $print = FALSE) {
  $invoice = [
    '#theme' => 'uc_order_invoice',
    '#order' => $uc_order,
    '#op' => $print ? 'print' : 'view',
  ];
  if ($print) {
    $build = [
      '#theme' => 'uc_order_invoice_page',
      '#content' => $invoice,
    ];
    $markup = \Drupal::service('renderer')
      ->renderPlain($build);
    $response = new Response($markup);
    $response->headers
      ->set('Content-Type', 'text/html; charset=utf-8');
    return $response;
  }
  return $invoice;
}