protected function ExportAllForm::createFilesList 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::createFilesList()
Create files list based on info from temp storage.
Parameters
array $files_info: Files info from temp storage.
Return value
array Render array of link items.
1 call to ExportAllForm::createFilesList()
- ExportAllForm::buildForm in modules/
bibcite_export/ src/ Form/ ExportAllForm.php - Form constructor.
File
- modules/
bibcite_export/ src/ Form/ ExportAllForm.php, line 96
Class
- ExportAllForm
- Export all reference data to any available export format.
Namespace
Drupal\bibcite_export\FormCode
protected function createFilesList(array $files_info) {
$items = [];
foreach ($files_info as $key => $file_info) {
if ($file = $this
->loadFile($file_info['id'])) {
$format = $this->formatManager
->createInstance($file_info['format']);
$date = date('m-d-Y H:i:s', $file_info['timestamp']);
$title = sprintf('%s - %s - %s', $file
->label(), $format
->getLabel(), $date);
$items[$key] = [
'#type' => 'link',
'#title' => $title,
'#url' => Url::fromRoute('bibcite_export.download', [
'file' => $file
->id(),
]),
];
}
else {
$this
->deleteFileInfoFromStorage($key);
}
}
return $items;
}