You are here

public function FormTestArgumentsObject::submitForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/form_test/src/FormTestArgumentsObject.php \Drupal\form_test\FormTestArgumentsObject::submitForm()
  2. 9 core/modules/system/tests/modules/form_test/src/FormTestArgumentsObject.php \Drupal\form_test\FormTestArgumentsObject::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 ConfigFormBase::submitForm

File

core/modules/system/tests/modules/form_test/src/FormTestArgumentsObject.php, line 59

Class

FormTestArgumentsObject
Provides a test form object that needs arguments.

Namespace

Drupal\form_test

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->messenger()
    ->addStatus($this
    ->t('The FormTestArgumentsObject::submitForm() method was used for this form.'));
  $this
    ->config('form_test.object')
    ->set('bananas', $form_state
    ->getValue('bananas'))
    ->save();
}