[BUGFIX] Element Browser uses FAL API in a wrong way
authorAndreas Wolf <andreas.wolf@typo3.org>
Sat, 1 Sep 2012 12:49:10 +0000 (14:49 +0200)
committerSteffen Ritter <info@rs-websystems.de>
Wed, 10 Oct 2012 11:08:12 +0000 (13:08 +0200)
The Element Browser needs a way to filter for certain file extensions.
FAL requires using a filter class for the storage; the EB did not
reflect this change until now. This commit adds a custom filter using
the configured file extension list.

Resolves: #39235
Releases: 6.0
Change-Id: I8237052417baf28081ba55fb221a3695710f6cad
Reviewed-on: http://review.typo3.org/14255
Reviewed-by: Mario Rimann
Reviewed-by: Stefan Neufeind
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php

index 7ce50d5..c1aeefd 100644 (file)
@@ -1472,7 +1472,11 @@ class ElementBrowser {
                        if ($renderFolders) {
                                $items = $folder->getSubfolders();
                        } else {
-                               $items = $folder->getFiles($extensionList);
+                               $filter = new \TYPO3\CMS\Core\Resource\Filter\FileExtensionFilter();
+                               $filter->setAllowedFileExtensions($extensionList);
+                               $folder->getStorage()->setFileAndFolderNameFilters(array(array($filter, 'filterFileList')));
+
+                               $items = $folder->getFiles();
                        }
                        $c = 0;
                        $totalItems = count($items);
@@ -2189,4 +2193,4 @@ class ElementBrowser {
 }
 
 
-?>
\ No newline at end of file
+?>