You are here

public function SettingsForm::validateForm in Domain Access 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

domain_config_ui/src/Form/SettingsForm.php, line 60

Class

SettingsForm
Class SettingsForm.

Namespace

Drupal\domain_config_ui\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $path_string = $form_state
    ->getValue('path_pages');
  $path_array = $this
    ->explodePathSettings($path_string);
  $exists = [];
  foreach ($path_array as $path) {
    if (in_array($path, $exists, TRUE)) {
      $form_state
        ->setError($form['pages']['path_pages'], $this
        ->t('Duplicate paths cannot be added'));
    }
    $exists[] = $path;
  }
}