public function SimplesitemapSettingsForm::validateForm in Simple XML sitemap 8.3
Same name and namespace in other branches
- 8.2 src/Form/SimplesitemapSettingsForm.php \Drupal\simple_sitemap\Form\SimplesitemapSettingsForm::validateForm()
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/ SimplesitemapSettingsForm.php, line 195
Class
- SimplesitemapSettingsForm
- Class SimplesitemapSettingsForm @package Drupal\simple_sitemap\Form
Namespace
Drupal\simple_sitemap\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$base_url = $form_state
->getValue('base_url');
$form_state
->setValue('base_url', rtrim($base_url, '/'));
if ($base_url !== '' && !UrlHelper::isValid($base_url, TRUE)) {
$form_state
->setErrorByName('base_url', $this
->t('The base URL is invalid.'));
}
}