public function ExportMultipleForm::submitForm in Bibliography & Citation 8
Same name and namespace in other branches
- 2.0.x modules/bibcite_export/src/Form/ExportMultipleForm.php \Drupal\bibcite_export\Form\ExportMultipleForm::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
- modules/
bibcite_export/ src/ Form/ ExportMultipleForm.php, line 134
Class
- ExportMultipleForm
- Export multiple reference entities.
Namespace
Drupal\bibcite_export\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$format = $this->formatManager
->createInstance($form_state
->getValue('format'));
$entity_type = 'bibcite_reference';
$ids = array_keys($this->entityInfo);
$chunks = array_chunk($ids, 100);
$operations = [];
foreach ($chunks as $chunk) {
$operations[] = [
'bibcite_export_batch_list',
[
$chunk,
$entity_type,
$format,
],
];
}
$batch = [
'title' => t('Export references'),
'operations' => $operations,
'file' => drupal_get_path('module', 'bibcite_export') . '/bibcite_export.batch.inc',
'finished' => 'bibcite_export_batch_finished',
];
batch_set($batch);
}