You are here

public function PushChangesConfirm::buildForm in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 8 src/Form/PushChangesConfirm.php \Drupal\cms_content_sync\Form\PushChangesConfirm::buildForm()
  2. 2.0.x src/Form/PushChangesConfirm.php \Drupal\cms_content_sync\Form\PushChangesConfirm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfirmFormBase::buildForm

File

src/Form/PushChangesConfirm.php, line 107

Class

PushChangesConfirm
Provides a node deletion confirmation form.

Namespace

Drupal\cms_content_sync\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  if (empty($this->nodes)) {
    return new RedirectResponse($this
      ->getCancelUrl()
      ->setAbsolute()
      ->toString());
  }
  $items = [];
  foreach ($this->nodes as $node) {
    $items[$node
      ->id()] = $node
      ->label();
  }
  $form['nodes'] = [
    '#theme' => 'item_list',
    '#items' => $items,
  ];
  return parent::buildForm($form, $form_state);
}