You are here

public function ExportConfirmForm::buildForm in Content Synchronizer 8.2

Same name and namespace in other branches
  1. 8 src/Form/ExportConfirmForm.php \Drupal\content_synchronizer\Form\ExportConfirmForm::buildForm()
  2. 3.x src/Form/ExportConfirmForm.php \Drupal\content_synchronizer\Form\ExportConfirmForm::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/ExportConfirmForm.php, line 111

Class

ExportConfirmForm
Class ExportConfirmForm.

Namespace

Drupal\content_synchronizer\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['content_synchronizer'] = [
    '#type' => 'fieldset',
    '#title' => t('Export'),
  ];
  $form['content_synchronizer']['quick_export'] = [
    '#type' => 'submit',
    '#value' => t('Export entity'),
    '#description' => t('Download the entity .zip file with dependencies'),
    '#button_type' => 'primary',
    '#submit' => [
      [
        $this,
        'onQuickExport',
      ],
    ],
  ];
  $exportsListOptions = $this->exportManager
    ->getExportsListOptions();
  if (!empty($exportsListOptions)) {
    $form['content_synchronizer']['exports_list'] = [
      '#type' => 'checkboxes',
      '#title' => t('Or add the entity to an existing export'),
      '#options' => $exportsListOptions,
    ];
    $form['content_synchronizer']['add_to_export'] = [
      '#type' => 'submit',
      '#value' => t('Add to the choosen export'),
      '#submit' => [
        [
          $this,
          'onAddToExport',
        ],
      ],
    ];
  }
  return $form;
}