You are here

public function WebhooksSettingsForm::validateForm in Acquia Content Hub 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/WebhooksSettingsForm.php, line 148

Class

WebhooksSettingsForm
Defines the form to register the webhooks.

Namespace

Drupal\acquia_contenthub\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (!UrlHelper::isValid($form_state
    ->getValue('webhook_url'), TRUE)) {
    return $form_state
      ->setErrorByName('webhook_url', $this
      ->t('This is not a valid URL. Please insert it again.'));
  }
}