You are here

public function SettingsForm::validateForm in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/Form/SettingsForm.php \Drupal\cms_content_sync\Form\SettingsForm::validateForm()
  2. 2.0.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 164

Class

SettingsForm
Content Sync general settings form.

Namespace

Drupal\cms_content_sync\Form

Code

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.');
  }
}