You are here

public function LaunchExportForm::submitForm in Content Synchronizer 8

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

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)) {
    $this->currentUrl = \Drupal::request()
      ->getRequestUri();
    $writer = new ExportEntityWriter();
    $writer
      ->initFromId($this->export
      ->label());
    $batchExportProcessor = new BatchExportProcessor($writer);
    $batchExportProcessor
      ->exportEntities($entitiesToExport, [
      $this,
      'onBatchEnd',
    ]);
  }
}