You are here

public function FlaggingCollectionTypeForm::validateForm in Flag Lists 8

Same name and namespace in other branches
  1. 4.0.x src/Form/FlaggingCollectionTypeForm.php \Drupal\flag_lists\Form\FlaggingCollectionTypeForm::validateForm()

Form validation 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 FormBase::validateForm

File

src/Form/FlaggingCollectionTypeForm.php, line 72

Class

FlaggingCollectionTypeForm
Class FlaggingCollectionTypeForm.

Namespace

Drupal\flag_lists\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {

  // Verify that the name is not longer than 32 charaters.
  if (strlen($form_state
    ->getValue('id')) > 32) {
    $form_state
      ->setErrorByName('id', $this
      ->t('Please provide an id that is maximum 32 characters long.'));
  }
  parent::validateForm($form, $form_state);
}