public function CashOnDelivery::cartDetails in Ubercart 8.4
Returns the form or render array to be displayed at checkout.
Parameters
\Drupal\uc_order\OrderInterface $order: The order which is being processed.
array $form: The checkout form array.
\Drupal\Core\Form\FormStateInterface $form_state: The checkout form state array.
Return value
array A form or render array.
Overrides PaymentMethodPluginBase::cartDetails
File
- payment/
uc_payment_pack/ src/ Plugin/ Ubercart/ PaymentMethod/ CashOnDelivery.php, line 70
Class
- CashOnDelivery
- Defines the cash on delivery payment method.
Namespace
Drupal\uc_payment_pack\Plugin\Ubercart\PaymentMethodCode
public function cartDetails(OrderInterface $order, array $form, FormStateInterface $form_state) {
$build['#attached']['library'][] = 'uc_payment_pack/cod.styles';
$build['policy'] = [
'#prefix' => '<p>',
'#markup' => Html::escape($this->configuration['policy']),
'#suffix' => '</p>',
];
if (($max = $this->configuration['max_order']) > 0 && is_numeric($max)) {
$build['eligibility'] = [
'#prefix' => '<p>',
'#markup' => $this
->t('Orders totalling more than @amount are <b>not eligible</b> for COD.', [
'@amount' => uc_currency_format($max),
]),
'#suffix' => '</p>',
];
}
if ($this->configuration['delivery_date']) {
$build += $this
->deliveryDateForm($order);
}
return $build;
}