You are here

public function ModalForm::submitForm in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/form_api_example/src/Form/ModalForm.php \Drupal\form_api_example\Form\ModalForm::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

form_api_example/src/Form/ModalForm.php, line 138

Class

ModalForm
Implements the ModalForm form controller.

Namespace

Drupal\form_api_example\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $title = $form_state
    ->getValue('title');
  $this
    ->messenger()
    ->addMessage($this
    ->t('Submit handler: You specified a title of @title.', [
    '@title' => $title,
  ]));
}