public function ExportAllForm::buildForm in Bibliography & Citation 2.0.x
Same name and namespace in other branches
- 8 modules/bibcite_export/src/Form/ExportAllForm.php \Drupal\bibcite_export\Form\ExportAllForm::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 FormInterface::buildForm
File
- modules/
bibcite_export/ src/ Form/ ExportAllForm.php, line 60
Class
- ExportAllForm
- Export all reference data to any available export format.
Namespace
Drupal\bibcite_export\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['format'] = [
'#title' => $this
->t('Export format'),
'#type' => 'select',
'#options' => array_map(function ($format) {
return $format['label'];
}, $this->formatManager
->getExportDefinitions()),
'#required' => TRUE,
];
if ($files = $this->tempStorage
->get('export_files')) {
$form['files'] = [
'#theme' => 'item_list',
'#title' => $this
->t('Files'),
'#items' => $this
->createFilesList($files),
];
}
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Export'),
];
return $form;
}