You are here

public function CheckoutFlowBase::submitForm in Commerce Core 8.2

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

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

Overrides FormInterface::submitForm

1 call to CheckoutFlowBase::submitForm()
CheckoutFlowWithPanesBase::submitForm in modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php
Form submission handler.
1 method overrides CheckoutFlowBase::submitForm()
CheckoutFlowWithPanesBase::submitForm in modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php
Form submission handler.

File

modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowBase.php, line 390

Class

CheckoutFlowBase
Provides the base checkout flow class.

Namespace

Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if ($next_step_id = $this
    ->getNextStepId($form['#step_id'])) {
    $this->order
      ->set('checkout_step', $next_step_id);
    $this
      ->onStepChange($next_step_id);
    $form_state
      ->setRedirect('commerce_checkout.form', [
      'commerce_order' => $this->order
        ->id(),
      'step' => $next_step_id,
    ]);
  }
  $this->order
    ->save();
}