protected function MetadataEventSubscriber::createData in Filebrowser 8.2
Same name and namespace in other branches
- 3.x src/EventSubscriber/MetadataEventSubscriber.php \Drupal\filebrowser\EventSubscriber\MetadataEventSubscriber::createData()
1 call to MetadataEventSubscriber::createData()
- MetadataEventSubscriber::setMetadata in src/
EventSubscriber/ MetadataEventSubscriber.php
File
- src/
EventSubscriber/ MetadataEventSubscriber.php, line 72
Class
Namespace
Drupal\filebrowser\EventSubscriberCode
protected function createData($id, $fid, $file, $subdir_fid) {
if ($file->fileData->type == 'file') {
/** @var DisplayFile $file */
switch ($id) {
case 'description':
return [
'content' => $this
->generateDescription($file, $subdir_fid, $fid),
'theme' => 'filebrowser_description',
];
case 'size':
return [
'content' => format_size($file->fileData->size),
'theme' => "",
];
case 'created':
return [
'theme' => "",
'content' => \Drupal::service('date.formatter')
->format($file->fileData->timestamp, 'short'),
];
case 'mimetype':
return [
'theme' => "",
'content' => $file->fileData->mimetype,
];
}
}
else {
if ($id == 'description') {
return [
'content' => $this
->generateDescription($file, $subdir_fid, $fid),
'theme' => 'filebrowser_description',
];
}
else {
return [
'theme' => "",
'content' => "",
];
}
}
}