You are here

public function LaunchExportForm::buildForm in Content Synchronizer 8

Same name and namespace in other branches
  1. 8.2 src/Form/LaunchExportForm.php \Drupal\content_synchronizer\Form\LaunchExportForm::buildForm()
  2. 3.x src/Form/LaunchExportForm.php \Drupal\content_synchronizer\Form\LaunchExportForm::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 FormInterface::buildForm

File

src/Form/LaunchExportForm.php, line 40

Class

LaunchExportForm
Launch Export Form.

Namespace

Drupal\content_synchronizer\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\content_synchronizer\Entity\ImportEntity $import */
  $this->export = $form_state
    ->getBuildInfo()['export'];

  // Entity list :
  $this
    ->initRootEntitiesList($form);
  if (array_key_exists('entities_list', $form)) {
    $form['launch'] = [
      '#type' => 'submit',
      '#value' => t('Launch export'),
      '#button_type' => 'primary',
    ];
    $form['deleteEntities'] = [
      '#type' => 'submit',
      '#value' => t('Remove selected entities from export list'),
      '#submit' => [
        '::removeSelectedEntities',
      ],
    ];
  }
  return $form;
}