function SearchEmbeddedForm::submitForm

Same name and namespace in other branches
  1. 9 core/modules/search/tests/modules/search_embedded_form/src/Form/SearchEmbeddedForm.php \Drupal\search_embedded_form\Form\SearchEmbeddedForm::submitForm()
  2. 8.9.x core/modules/search/tests/modules/search_embedded_form/src/Form/SearchEmbeddedForm.php \Drupal\search_embedded_form\Form\SearchEmbeddedForm::submitForm()
  3. 10 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 51

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 = $state->get('search_embedded_form.submit_count', 0);
  $state->set('search_embedded_form.submit_count', $submit_count + 1);
  $this->messenger()
    ->addStatus($this->t('Test form was submitted'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.