public function CouponRedemption::submitPaneForm in Commerce Core 8.2
Handles the submission of an pane form.
Parameters
array $pane_form: The pane form.
\Drupal\Core\Form\FormStateInterface $form_state: The form state of the parent form.
array $complete_form: The complete form structure.
Overrides CheckoutPaneBase::submitPaneForm
File
- modules/
promotion/ src/ Plugin/ Commerce/ CheckoutPane/ CouponRedemption.php, line 136
Class
- CouponRedemption
- Provides the coupon redemption pane.
Namespace
Drupal\commerce_promotion\Plugin\Commerce\CheckoutPaneCode
public function submitPaneForm(array &$pane_form, FormStateInterface $form_state, array &$complete_form) {
// The form was submitted with a non-applied coupon in the input field,
// mapped to a coupon ID in CouponRedemptionForm::validateForm().
if (!empty($pane_form['form']['code']['#coupon_id'])) {
$this->order
->get('coupons')
->appendItem($pane_form['form']['code']['#coupon_id']);
}
}