[BUGFIX] Respect all filemounts in file collection 19/27119/3
authorAlexander Stehlik <alexander.stehlik@googlemail.com>
Thu, 30 Jan 2014 10:43:13 +0000 (11:43 +0100)
committerFrans Saris <franssaris@gmail.com>
Wed, 26 Feb 2014 18:47:12 +0000 (19:47 +0100)
The directory selector in a file collection now displays the folders
of all filemounts of a user. Before only the folders of the first
filemount were displayed.

Resolves: #55414
Releases: 6.2
Change-Id: Ic47f5163e2cfc7c89edcba4119f06620ed0fd56e
Reviewed-on: https://review.typo3.org/27119
Reviewed-by: Wouter Wolters
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Frans Saris
Tested-by: Frans Saris
typo3/sysext/core/Classes/Resource/Service/UserFileMountService.php

index 27880ab..38fa17d 100644 (file)
@@ -62,13 +62,25 @@ class UserFileMountService {
                        /** @var $storage \TYPO3\CMS\Core\Resource\ResourceStorage */
                        $storage = $storageRepository->findByUid($storageUid);
                        if ($storage->isBrowsable()) {
-                               $rootLevelFolder = $storage->getRootLevelFolder();
-                               $folderItems = $this->getSubfoldersForOptionList($rootLevelFolder);
-                               foreach ($folderItems as $item) {
-                                       $PA['items'][] = array(
-                                               $item->getIdentifier(),
-                                               $item->getIdentifier()
-                                       );
+                               $rootLevelFolders = array();
+
+                               $fileMounts = $storage->getFileMounts();
+                               if (!empty($fileMounts)) {
+                                       foreach ($fileMounts as $fileMountInfo) {
+                                               $rootLevelFolders[] = $fileMountInfo['folder'];
+                                       }
+                               } else {
+                                       $rootLevelFolders[] = $storage->getRootLevelFolder();
+                               }
+
+                               foreach ($rootLevelFolders as $rootLevelFolder) {
+                                       $folderItems = $this->getSubfoldersForOptionList($rootLevelFolder);
+                                       foreach ($folderItems as $item) {
+                                               $PA['items'][] = array(
+                                                       $item->getIdentifier(),
+                                                       $item->getIdentifier()
+                                               );
+                                       }
                                }
                        } else {
                                /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */