You are here

public function CopyRemoteFlow::form 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::form()
  2. 2.0.x src/Form/CopyRemoteFlow.php \Drupal\cms_content_sync\Form\CopyRemoteFlow::form()

Gets the actual form array to be built.

Overrides EntityForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

src/Form/CopyRemoteFlow.php, line 123

Class

CopyRemoteFlow
Form handler for the Pool add and edit forms.

Namespace

Drupal\cms_content_sync\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $form['#tree'] = false;
  $step = $this
    ->getCurrentFormStep($form_state);
  if (self::STEP_SYNC_CORE === $step) {
    $elements = $this
      ->syncCoreForm($form, $form_state);
    $form['#method'] = 'get';
  }
  elseif (self::STEP_POOLS === $step) {
    $elements = $this
      ->poolsForm($form, $form_state);
  }
  elseif (self::STEP_FLOW_LIST === $step) {
    $elements = $this
      ->flowListForm($form, $form_state);
  }
  else {
    $elements = $this
      ->flowImportForm($form, $form_state);
  }
  $form['elements'] = array_merge([
    '#prefix' => '<div id="' . self::CONTAINER_ID . '">',
    '#suffix' => '</div>',
    'step' => [
      '#type' => 'hidden',
      '#value' => $step,
    ],
  ], $elements);
  return $form;
}