function FormTestLimitValidationErrorsForm::partialSubmitForm

Same name in other branches
  1. 8.9.x core/modules/system/tests/modules/form_test/src/Form/FormTestLimitValidationErrorsForm.php \Drupal\form_test\Form\FormTestLimitValidationErrorsForm::partialSubmitForm()
  2. 10 core/modules/system/tests/modules/form_test/src/Form/FormTestLimitValidationErrorsForm.php \Drupal\form_test\Form\FormTestLimitValidationErrorsForm::partialSubmitForm()
  3. 11.x core/modules/system/tests/modules/form_test/src/Form/FormTestLimitValidationErrorsForm.php \Drupal\form_test\Form\FormTestLimitValidationErrorsForm::partialSubmitForm()

File

core/modules/system/tests/modules/form_test/src/Form/FormTestLimitValidationErrorsForm.php, line 103

Class

FormTestLimitValidationErrorsForm
Builds a simple form with a button triggering partial validation.

Namespace

Drupal\form_test\Form

Code

public function partialSubmitForm(array &$form, FormStateInterface $form_state) {
    // The title has not been validated, thus its value - in case of the test case
    // an empty string - may not be set.
    if (!$form_state->hasValue('title') && $form_state->hasValue('test')) {
        $this->messenger()
            ->addStatus('Only validated values appear in the form values.');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.