You are here

public function WebhookEditForm::validateForm in Acquia Content Hub 8.2

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

modules/acquia_contenthub_publisher/src/Form/Webhook/WebhookEditForm.php, line 60

Class

WebhookEditForm
Class WebhookEditForm.

Namespace

Drupal\acquia_contenthub_publisher\Form\Webhook

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $url = trim($form_state
    ->getValue('url'));
  if (!UrlHelper::isValid($url, TRUE)) {
    $form_state
      ->setErrorByName('url', $this
      ->t('URL is not valid.'));
  }
}