You are here

public function ViewsFormMainForm::submitForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Form/ViewsFormMainForm.php \Drupal\views\Form\ViewsFormMainForm::submitForm()
  2. 10 core/modules/views/src/Form/ViewsFormMainForm.php \Drupal\views\Form\ViewsFormMainForm::submitForm()

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

File

core/modules/views/src/Form/ViewsFormMainForm.php, line 177

Class

ViewsFormMainForm

Namespace

Drupal\views\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $view = $form_state
    ->getBuildInfo()['args'][0];

  // Call the submit method on every field handler that has it.
  foreach ($view->field as $field) {
    if (method_exists($field, 'viewsFormSubmit')) {
      $field
        ->viewsFormSubmit($form, $form_state);
    }
  }

  // Call the submit method on every area handler that has it.
  foreach ([
    'header',
    'footer',
  ] as $area) {
    foreach ($view->{$area} as $area_handler) {
      if (method_exists($area_handler, 'viewsFormSubmit')) {
        $area_handler
          ->viewsFormSubmit($form, $form_state);
      }
    }
  }
}