initializeResultArray();
$fileUid = 0;
if ($this->data['tableName'] === 'sys_file') {
$fileUid = (int)$this->data['databaseRow']['uid'];
} elseif ($this->data['tableName'] === 'sys_file_metadata') {
$fileUid = (int)($this->data['databaseRow']['file'][0] ?? 0);
}
$fileObject = null;
if ($fileUid > 0) {
$fileObject = $this->resourceFactory->getFileObject($fileUid);
}
$resultArray['html'] = $this->renderFileInformationContent($fileObject);
return $resultArray;
}
/**
* Renders a HTML Block with file information
*/
protected function renderFileInformationContent(?File $file = null): string
{
$lang = $this->getLanguageService();
if ($file !== null) {
$content = '';
if ($file->isMissing()) {
$content .= ''
. htmlspecialchars($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:warning.file_missing'))
. '';
}
if ($file->isImage() || $file->isMediaFile()) {
$processedFile = $file->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, ['width' => '150m', 'height' => '150m']);
$previewImage = $processedFile->getPublicUrl();
if ($previewImage) {
$content .= 'getProperty('width') . '" '
. 'height="' . $processedFile->getProperty('height') . '" '
. 'alt="" class="t3-tceforms-sysfile-imagepreview" />';
}
}
$content .= '' . htmlspecialchars($file->getName()) . '';
$content .= ' (' . htmlspecialchars(GeneralUtility::formatSize((int)$file->getSize())) . 'bytes)
';
$content .= BackendUtility::getProcessedValue('sys_file', 'type', (string)$file->getType()) . ' (' . $file->getMimeType() . ')
';
$content .= htmlspecialchars($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:fileMetaDataLocation')) . ': ';
$content .= '' . htmlspecialchars($file->getStorage()->getName()) . ' - ' . htmlspecialchars($file->getIdentifier()) . '
';
$content .= '
';
} else {
$content = '