[BUGFIX] Add support for t3:// syntax to FileCollector 14/54314/2
authorJigal van Hemert <jigal.van.hemert@typo3.org>
Sun, 1 Oct 2017 11:08:52 +0000 (13:08 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sat, 7 Oct 2017 09:36:21 +0000 (11:36 +0200)
FileCollector::addFilesFromFolder now supports the t3://folder URN as
identifier for a folder. This allows the FILES cObj and the
FilesProcessor data processing to use that syntax.

Resolves: #82627
Releases: master, 8.7
Change-Id: I31376169f5868c6f7c52cf2b6ca98fe41bb1e111
Reviewed-on: https://review.typo3.org/54314
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/frontend/Classes/Resource/FileCollector.php

index 5876b25..a8d900f 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Frontend\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\LinkHandling\LinkService;
 use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Resource\Exception;
 use TYPO3\CMS\Core\Resource\FileCollectionRepository;
@@ -178,7 +179,14 @@ class FileCollector implements \Countable
     {
         if ($folderIdentifier) {
             try {
-                $folder = $this->getResourceFactory()->getFolderObjectFromCombinedIdentifier($folderIdentifier);
+                if (strpos($folderIdentifier, 't3://folder') === 0) {
+                    // a t3://folder link to a folder in FAL
+                    $linkService = GeneralUtility::makeInstance(LinkService::class);
+                    $data = $linkService->resolveByStringRepresentation($folderIdentifier);
+                    $folder = $data['folder'];
+                } else {
+                    $folder = $this->getResourceFactory()->getFolderObjectFromCombinedIdentifier($folderIdentifier);
+                }
                 if ($folder instanceof Folder) {
                     $files = $folder->getFiles(0, 0, Folder::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, $recursive);
                     $this->addFileObjects(array_values($files));