Feature #65209
closedFAL - link to File in IRRE
0%
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
Updated by Frans Saris almost 10 years ago
- Status changed from New to Needs Feedback
With 6.2.10 there is an info icon added to the header of the IRRE element that opens the file info window. There is a download link present.
I guess that is the same as you try to achieve.
Updated by Guy Couronné over 9 years ago
I pulled 6.2.10 and that's exactly what I need.
This could be closed.
Updated by Alexander Opitz over 9 years ago
- Status changed from Needs Feedback to Closed
Thanks for feedback.