You are here

public function SimpleForm::submitForm in Form API Validation 8.2

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

fapiv_example/src/Form/SimpleForm.php, line 94

Class

SimpleForm
Implements the SimpleForm form controller.

Namespace

Drupal\fapiv_example\Form

Code

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');
  drupal_set_message($this
    ->t('You specified a title of %title.', [
    '%title' => $title,
  ]));
}