You are here

public function SearchForm::submitForm in Simple Google Custom Search Engine 8

Same name and namespace in other branches
  1. 2.0.x src/Form/SearchForm.php \Drupal\simple_gse_search\Form\SearchForm::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

src/Form/SearchForm.php, line 50

Class

SearchForm
Defines a form for performing a simple redirect to display search results.

Namespace

Drupal\simple_gse_search\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->setRedirectUrl(Url::fromRoute('simple_gse_search.search_page', [], [
    'query' => [
      's' => $form_state
        ->getValue('s'),
    ],
  ]));
}