function SimpleForm::submitForm
Same name in other branches
- 8.x-1.x form_api_example/src/Form/SimpleForm.php \Drupal\form_api_example\Form\SimpleForm::submitForm()
- 4.0.x modules/form_api_example/src/Form/SimpleForm.php \Drupal\form_api_example\Form\SimpleForm::submitForm()
Implements a form submit handler.
The submitForm method is the default method called for any submit elements.
Parameters
array $form: The render array of the currently built form.
\Drupal\Core\Form\FormStateInterface $form_state: Object describing the current state of the form.
Overrides FormInterface::submitForm
File
-
modules/
form_api_example/ src/ Form/ SimpleForm.php, line 105
Class
- SimpleForm
- Implements the SimpleForm form controller.
Namespace
Drupal\form_api_example\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
/*
* This would normally be replaced by code that actually does something
* with the title.
*/
$title = $form_state->getValue('title');
$this->messenger()
->addMessage($this->t('You specified a title of %title.', [
'%title' => $title,
]));
}