function StateDemo::submitForm
Same name in other branches
- 8.x-1.x form_api_example/src/Form/StateDemo.php \Drupal\form_api_example\Form\StateDemo::submitForm()
- 4.0.x modules/form_api_example/src/Form/StateDemo.php \Drupal\form_api_example\Form\StateDemo::submitForm()
Implements submitForm callback.
@inheritdoc
Overrides DemoBase::submitForm
File
-
modules/
form_api_example/ src/ Form/ StateDemo.php, line 95
Class
- StateDemo
- Implements the state demo form controller.
Namespace
Drupal\form_api_example\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Find out what was submitted.
$values = $form_state->getValues();
if ($values['needs_accommodation']) {
$this->messenger()
->addMessage($this->t('Dietary Restriction Requested: %diet', [
'%diet' => $values['diet'],
]));
}
}