You are here

public function EditFolderForm::validateForm in Taxonomy File Tree 8

Same name and namespace in other branches
  1. 3.x src/Form/EditFolderForm.php \Drupal\tft\Form\EditFolderForm::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/EditFolderForm.php, line 59

Class

EditFolderForm
Edit a term form.

Namespace

Drupal\tft\Form

Code

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

  // Check for forbidden characters.
  if (strpos($form_state
    ->getValue('name'), ',') !== FALSE || strpos($form_state
    ->getValue('name'), '+') !== FALSE) {
    $form_state
      ->setErrorByName('name', $this
      ->t("The following characters are not allowed: ',' (comma) and +"));
  }
}