You are here

public function SearchEmbeddedForm::submitForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/search/tests/modules/search_embedded_form/src/Form/SearchEmbeddedForm.php \Drupal\search_embedded_form\Form\SearchEmbeddedForm::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/tests/modules/search_embedded_form/src/Form/SearchEmbeddedForm.php, line 49

Class

SearchEmbeddedForm
Form controller for search_embedded_form form.

Namespace

Drupal\search_embedded_form\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $state = \Drupal::state();
  $submit_count = (int) $state
    ->get('search_embedded_form.submit_count');
  $state
    ->set('search_embedded_form.submit_count', $submit_count + 1);
  $this
    ->messenger()
    ->addStatus($this
    ->t('Test form was submitted'));
}