You are here

public function ViewsExposedForm::submitForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Form/ViewsExposedForm.php \Drupal\views\Form\ViewsExposedForm::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/ViewsExposedForm.php, line 153
Contains \Drupal\views\Form\ViewsExposedForm.

Class

ViewsExposedForm
Provides the views exposed form.

Namespace

Drupal\views\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  foreach (array(
    'field',
    'filter',
  ) as $type) {

    /** @var \Drupal\views\Plugin\views\ViewsHandlerInterface[] $handlers */
    $handlers =& $form_state
      ->get('view')->{$type};
    foreach ($handlers as $key => $info) {
      $handlers[$key]
        ->submitExposed($form, $form_state);
    }
  }
  $view = $form_state
    ->get('view');
  $view->exposed_data = $form_state
    ->getValues();
  $view->exposed_raw_input = [];
  $exclude = array(
    'submit',
    'form_build_id',
    'form_id',
    'form_token',
    'exposed_form_plugin',
    'reset',
  );

  /** @var \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase $exposed_form_plugin */
  $exposed_form_plugin = $view->display_handler
    ->getPlugin('exposed_form');
  $exposed_form_plugin
    ->exposedFormSubmit($form, $form_state, $exclude);
  foreach ($form_state
    ->getValues() as $key => $value) {
    if (!in_array($key, $exclude)) {
      $view->exposed_raw_input[$key] = $value;
    }
  }
}