Actions
Feature #65209
closedFAL - link to File in IRRE
Status:
Closed
Priority:
Could have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2015-02-20
Due date:
% Done:
0%
Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:
Description
Hi,
I'm creating a report with .HTML attached, and I would like to download it without passing by module filelist. I didn't find, while editing a File Reference, how to get its file.
I would like something like this fal_link-to-file_example.png.
To do this, I add a field in TCA :
'bar_fal' => array( 'exclude' => true, 'label' => 'FAL link to File' 'config' => array( 'type' => 'user', 'userFunc' => '\Foo\\BarFal\\Userfuncs\\TCAField->displayLink' ) )
The method called is :
/** * * @param array $PA * @param \TYPO3\CMS\Backend\Form\FormEngine $pObj * @return string */ public function displayLink(array $PA, \TYPO3\CMS\Backend\Form\FormEngine $pObj) { $formField = ''; if (is_numeric($PA['row']['uid'])) { $fileReference = $this->resourceFactory->getFileReferenceObject($PA['row']['uid']); //\TYPO3\CMS\Core\Resource\ResourceFactory if (!empty($fileReference)) { $file = $fileReference->getOriginalFile(); if (!empty($file)) { $fileUrl = $file->getPublicUrl(true); if (!empty($fileUrl)) { $filename = htmlspecialchars(trim($file->getName())); $clickHere = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate( 'fal.link', 'bar_fal' ); $aOnClick = 'return top.openUrlInWindow(\'' . $fileUrl . '\', \'WebFile\');'; $formField = '<div><a href="#" title="' . $filename . '" onclick="' . htmlspecialchars($aOnClick) . '">' . $clickHere . '</a></div>'; } } } } return $formField; }
It's based on \TYPO3\CMS\Filelist\FileList->linkWrapFile(..);
To avoid error with dataMap, I unset it in hook (processDatamap_preProcessFieldArray).
What do you think ?
Files
Actions