public function MauticAdminSettingsForm::validateForm in Mautic Integration 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/ MauticAdminSettingsForm.php, line 144
Class
- MauticAdminSettingsForm
- Configure Mautic settings for this site.
Namespace
Drupal\mautic\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
$url_is_valid = UrlHelper::isValid($form_state
->getValue('mautic_base_url'), $absolute = TRUE);
// Check if is a valid url.
if (!$url_is_valid) {
$form_state
->setErrorByName('mautic_base_url', $this
->t('The URL is not valid.'));
}
}