#57832Preview inline files in BE (info icon)
Description
We’re missing the option to preview files in the BE like you can do in the filelist module.
I have created a small patch. Not sure how to submit it but please feel free to implement it if it makes any sense at all:
TYPO3\CMS\Backend\Form\Element\InlineElement.php:675
// "Info": (All records)
if ($enabledControls['info'] && !$isNewItem) {
// Treat the record as a file
if($rec['table_local'] == 'sys_file'){
$idArray = explode('_',$rec['uid_local']);
$fileId = array_pop($idArray);
if(\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($fileId)){
$fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($fileId);
}
if($fileObject instanceof \TYPO3\CMS\Core\Resource\File){
$cells['info'] = '<a href="#" onclick="' . htmlspecialchars(('top.launchView(\'_FILE\', \''. $fileObject->getProperty('storage') . ':' . $fileObject->getProperty('identifier') . '\'); return false;')) . '">' . IconUtility::getSpriteIcon('status-dialog-information', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:showInfo', TRUE))) . '</a>';
}
} else {
$cells['info'] = '<a href="#" onclick="' . htmlspecialchars(('top.launchView(\'' . $foreign_table . '\', \'' . $rec['uid'] . '\'); return false;')) . '">' . IconUtility::getSpriteIcon('status-dialog-information', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:showInfo', TRUE))) . '</a>';
}
}
The code checks if the “table_local” of the current record is a sys_file and then produces the same preview code as the file list does.
-Einar