You are here

public function AddToCopyForm::validateForm in Add link to copied text 8

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/Forms/AddToCopyForm.php, line 69

Class

AddToCopyForm
Provides a configuration form for addtocopy settings.

Namespace

Drupal\addtocopy\Forms

Code

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

  // Check for numeric min length.
  $min_length = $form_state
    ->getValue('addtocopy_minlen');
  if (!is_numeric($min_length)) {

    // Show error for numeric value.
    $form_state
      ->setErrorByName('addtocopy_minlen', $this
      ->t("Please enter numeric value."));
  }
  parent::validateForm($form, $form_state);
}