[TASK] Remove special TSFE handling in FileCollector 50/61350/4
authorBenni Mack <benni@typo3.org>
Thu, 25 Jul 2019 06:12:32 +0000 (08:12 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 2 Aug 2019 12:01:28 +0000 (14:01 +0200)
The FileCollector is e.g. used for resolving
references in the FILES cObject. The check for
TSFE can be removed since the ->getFileReferences
functionality should be used at any time, as the
functionality always handles overlays depending
on the $referenceRecord given.

Resolves: #88859
Releases: master
Change-Id: I500421a12cced80e133b12a0caf6dcf289c6bd9a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61350
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/frontend/Classes/Resource/FileCollector.php

index 4b6568d..77562ae 100644 (file)
@@ -98,12 +98,7 @@ class FileCollector implements \Countable, LoggerAwareInterface
      */
     public function addFilesFromRelation($relationTable, $relationField, array $referenceRecord)
     {
-        if (is_object($GLOBALS['TSFE']) && is_object($GLOBALS['TSFE']->sys_page)) {
-            $fileReferences = $this->getFileReferences($relationTable, $relationField, $referenceRecord);
-        } else {
-            $fileReferences = $this->getFileRepository()->findByRelation($relationTable, $relationField, $referenceRecord['uid']);
-        }
-
+        $fileReferences = $this->getFileReferences($relationTable, $relationField, $referenceRecord);
         if (!empty($fileReferences)) {
             $this->addFileObjects($fileReferences);
         }
@@ -280,7 +275,8 @@ class FileCollector implements \Countable, LoggerAwareInterface
     }
 
     /**
-     * Gets file references for a given record field.
+     * Gets file references for a given record field, also deal with translated elements,
+     * where file references could be attached.
      *
      * @param string $tableName Name of the table
      * @param string $fieldName Name of the field