You are here

public function CheckoutFlowWithPanesBase::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 CheckoutFlowBase::submitForm

File

modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php, line 598

Class

CheckoutFlowWithPanesBase
Provides a base checkout flow that uses checkout panes.

Namespace

Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  foreach ($this
    ->getVisiblePanes($form['#step_id']) as $pane_id => $pane) {
    if (!isset($form[$pane_id])) {
      continue;
    }
    $pane
      ->submitPaneForm($form[$pane_id], $form_state, $form);
  }
  if ($this
    ->hasSidebar($form['#step_id'])) {
    foreach ($this
      ->getVisiblePanes('_sidebar') as $pane_id => $pane) {
      if (!isset($form['sidebar'][$pane_id])) {
        continue;
      }
      $pane
        ->submitPaneForm($form['sidebar'][$pane_id], $form_state, $form);
    }
  }
  parent::submitForm($form, $form_state);
}