You are here

public function LaunchExportForm::submitForm in Content Synchronizer 3.x

Same name and namespace in other branches
  1. 8.2 src/Form/LaunchExportForm.php \Drupal\content_synchronizer\Form\LaunchExportForm::submitForm()
  2. 8 src/Form/LaunchExportForm.php \Drupal\content_synchronizer\Form\LaunchExportForm::submitForm()

Form submission handler.

Parameters

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

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

Overrides FormInterface::submitForm

File

src/Form/LaunchExportForm.php, line 103

Class

LaunchExportForm
Launch Export Form.

Namespace

Drupal\content_synchronizer\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $entitiesToExport = $form_state
    ->getUserInput()['entities_to_export'];
  $entitiesToExport = array_intersect_key($this->export
    ->getEntitiesList(), array_flip($entitiesToExport));
  if (!empty($entitiesToExport)) {
    $writer = new ExportEntityWriter();
    $writer
      ->initFromId($this->export
      ->label());
    $batchExportProcessor = new BatchExportProcessor($writer);
    $batchExportProcessor
      ->exportEntities($entitiesToExport, [
      $this,
      'onBatchEnd',
    ]);
  }
}