You are here

public function CopyRemoteFlow::validateForm in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/Form/CopyRemoteFlow.php \Drupal\cms_content_sync\Form\CopyRemoteFlow::validateForm()
  2. 2.0.x src/Form/CopyRemoteFlow.php \Drupal\cms_content_sync\Form\CopyRemoteFlow::validateForm()

Validate format of input fields and make sure the Sync Core backend is accessible to actually update it.

Overrides FormBase::validateForm

File

src/Form/CopyRemoteFlow.php, line 158

Class

CopyRemoteFlow
Form handler for the Pool add and edit forms.

Namespace

Drupal\cms_content_sync\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  $step = $this
    ->getLastFormStep($form_state);
  if (self::STEP_FLOW_IMPORT === $step) {
    $id = $form_state
      ->getValue('id');
    if (!empty(Flow::getAll(false)[$id])) {
      $form_state
        ->setError($form['elements']['id'], $this
        ->t('A Flow with this ID already exists on this site. Please change it.'));
    }
  }
}