You are here

public function JavascriptLibrariesDefaultForm::validateForm in JavaScript Libraries Manager 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/Form/JavascriptLibrariesDefaultForm.php, line 87
Contains \Drupal\javascript_libraries\Form\JavascriptLibrariesDefaultForm.

Class

JavascriptLibrariesDefaultForm

Namespace

Drupal\javascript_libraries\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (empty($form_state
    ->getValue('lib'))) {
    $form_state
      ->setErrorByName('lib', $this
      ->t("Please enter a valid core library name."));
  }
}