public function submitForm(array &
$form, FormStateInterface
$form_state) { // Form input keys that will not be included in $view->exposed_raw_data.
$exclude =
['submit', 'form_build_id', 'form_id', 'form_token', 'exposed_form_plugin', 'reset'
];
$values =
$form_state->
getValues();
foreach (['field', 'filter'
] as $type) { /** @var \Drupal\views\Plugin\views\ViewsHandlerInterface[] $handlers */
$handlers = &
$form_state->
get('view'
)->
$type;
foreach ($handlers as $key =>
$info) { if ($handlers[$key]->
acceptExposedInput($values)) { $handlers[$key]->
submitExposed($form,
$form_state);
} else { // The input from the form did not validate, exclude it from the
// stored raw data.
$exclude[] =
$key;
} } } $view =
$form_state->
get('view'
);
$view->exposed_data =
$values;