You are here

public function Manual::buildPaymentInstructions in Commerce Core 8.2

Builds the payment instructions.

Parameters

\Drupal\commerce_payment\Entity\PaymentInterface $payment: The payment.

Return value

array A render array containing the payment instructions.

Overrides HasPaymentInstructionsInterface::buildPaymentInstructions

File

modules/payment/src/Plugin/Commerce/PaymentGateway/Manual.php, line 138

Class

Manual
Provides the Manual payment gateway.

Namespace

Drupal\commerce_payment\Plugin\Commerce\PaymentGateway

Code

public function buildPaymentInstructions(PaymentInterface $payment) {
  $instructions = [];
  if (!empty($this->configuration['instructions']['value'])) {
    $instructions_text = $this->token
      ->replace($this->configuration['instructions']['value'], [
      'commerce_order' => $payment
        ->getOrder(),
      'commerce_payment' => $payment,
    ]);
    $instructions = [
      '#type' => 'processed_text',
      '#text' => $instructions_text,
      '#format' => $this->configuration['instructions']['format'],
    ];
  }
  return $instructions;
}