public function SettingsForm::validateForm in CMS Content Sync 2.0.x
Same name and namespace in other branches
- 8 src/Form/SettingsForm.php \Drupal\cms_content_sync\Form\SettingsForm::validateForm()
- 2.1.x src/Form/SettingsForm.php \Drupal\cms_content_sync\Form\SettingsForm::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/ SettingsForm.php, line 174
Class
- SettingsForm
- Content Sync general settings form.
Namespace
Drupal\cms_content_sync\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
$base_url = $form_state
->getValue('cms_content_sync_base_url');
if (!empty($base_url) && '/' === mb_substr($base_url, -1)) {
$form_state
->setErrorByName('cms_content_sync_base_url', 'Do not include a trailing slash.');
}
}