public function ContentExportMultiple::submitForm in Content Synchronization 3.0.x
Same name and namespace in other branches
- 8.2 src/Form/ContentExportMultiple.php \Drupal\content_sync\Form\ContentExportMultiple::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/ ContentExportMultiple.php, line 149
Class
- ContentExportMultiple
- Class ContentExportMultiple
Namespace
Drupal\content_sync\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
if ($form_state
->getValue('confirm') && !empty($this->entityList)) {
// Delete the content tar file in case an older version exist.
$this->fileSystem
->delete($this
->getTempFile());
$entities_list = [];
foreach ($this->entityList as $entity_info) {
$entities_list[] = [
'entity_type' => $entity_info['entity_type'],
'entity_id' => $entity_info['entity_id'],
];
}
if (!empty($entities_list)) {
$serializer_context['export_type'] = 'tar';
$serializer_context['include_files'] = 'folder';
$batch = $this
->generateExportBatch($entities_list, $serializer_context);
batch_set($batch);
}
}
else {
$form_state
->setRedirect('system.admin_content');
}
}