public function WebhookAddForm::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/ WebhookAddForm.php, line 42
Class
- WebhookAddForm
- Class WebhookAddForm.
Namespace
Drupal\acquia_contenthub_publisher\Form\WebhookCode
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.'));
}
}