function OneForm::submitForm

Same name in other branches
  1. 8.x-3.x tests/modules/ctools_wizard_test/src/Form/OneForm.php \Drupal\ctools_wizard_test\Form\OneForm::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

tests/modules/ctools_wizard_test/src/Form/OneForm.php, line 57

Class

OneForm
Simple wizard step form.

Namespace

Drupal\ctools_wizard_test\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $keys = [
        'one',
    ];
    $cached_values = $form_state->getTemporaryValue('wizard');
    foreach ($keys as $key) {
        $cached_values[$key] = $form_state->getValue($key);
    }
    $form_state->setTemporaryValue('wizard', $cached_values);
    $this->messenger()
        ->addMessage($this->t('Dynamic value submitted: @value', [
        '@value' => $cached_values['dynamic'],
    ]));
}