You are here

public function CouponRedemption::buildPaneForm in Commerce Core 8.2

Builds the pane form.

Parameters

array $pane_form: The pane form, containing the following basic properties:

  • #parents: Identifies the position of the pane form in the overall parent form, and identifies the location where the field values are placed within $form_state->getValues().

\Drupal\Core\Form\FormStateInterface $form_state: The form state of the parent form.

array $complete_form: The complete form structure.

Overrides CheckoutPaneInterface::buildPaneForm

File

modules/promotion/src/Plugin/Commerce/CheckoutPane/CouponRedemption.php, line 119

Class

CouponRedemption
Provides the coupon redemption pane.

Namespace

Drupal\commerce_promotion\Plugin\Commerce\CheckoutPane

Code

public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
  $inline_form = $this->inlineFormManager
    ->createInstance('coupon_redemption', [
    'order_id' => $this->order
      ->id(),
    'max_coupons' => $this->configuration['allow_multiple'] ? NULL : 1,
  ]);
  $pane_form['form'] = [
    '#parents' => array_merge($pane_form['#parents'], [
      'form',
    ]),
  ];
  $pane_form['form'] = $inline_form
    ->buildInlineForm($pane_form['form'], $form_state);
  return $pane_form;
}