You are here

public function ShurlyEditForm::validateForm in ShURLy 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/ShurlyEditForm.php, line 134

Class

ShurlyEditForm
ShurlyActionsForm.

Namespace

Drupal\shurly\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (!shurly_validate_long($form_state
    ->getValue('destination'))) {
    $form_state
      ->setErrorByName('long_url', t('Invalid URL'));
  }
}