public function SearchPageForm::submitForm in Drupal 8
Same name and namespace in other branches
- 9 core/modules/search/src/Form/SearchPageForm.php \Drupal\search\Form\SearchPageForm::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/ search/ src/ Form/ SearchPageForm.php, line 86
Class
- SearchPageForm
- Provides a search form for site wide search.
Namespace
Drupal\search\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Redirect to the search page with keywords in the GET parameters.
// Plugins with additional search parameters will need to provide their
// own form submit handler to replace this, so they can put their values
// into the GET as well. If so, make sure to put 'keys' into the GET
// parameters so that the search results generation is triggered.
$query = $this->entity
->getPlugin()
->buildSearchUrlQuery($form_state);
$route = 'search.view_' . $form_state
->get('search_page_id');
$form_state
->setRedirect($route, [], [
'query' => $query,
]);
}