Feature #57832
closedPreview inline files in BE (info icon)
0%
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
Files
Updated by Frans Saris over 10 years ago
- Status changed from New to Needs Feedback
Could you provide a screenshot of the result of this patch so I can understant what you want to achieve?
Gr. Frans
Updated by Einar Gislason over 10 years ago
- File withoutpatch.png withoutpatch.png added
- File withpatch.png withpatch.png added
Please see the 2 attached screenshots from two different 6.2.0 sites
Without the patch the info field on the inline media elm. just displays some metainfo on the image. WIth the patch the image is shown and is downloadable, just like in Filelist.
Hope this clears things up.
Updated by Frans Saris over 10 years ago
Hi Einar,
Thanks for the info and screenshots.
I simplified your change and push a patch to the review system.
gr. Frans
Updated by Gerrit Code Review over 10 years ago
- Status changed from Needs Feedback to Under Review
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29651
Updated by Frans Saris over 10 years ago
- Status changed from Under Review to Resolved
Applied in changeset 67dbe5b927be564420f9faea8ce932221adcb6fe.