You are here

public function FormTestLimitValidationErrorsForm::partialSubmitForm in Drupal 8

Same name and namespace in other branches
  1. 9 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()

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.');
  }
}