[TASK] Add FileCollectionRegistry
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / ResourceFactory.php
index c75478f..0d5a1f6 100644 (file)
@@ -296,20 +296,11 @@ class ResourceFactory implements \TYPO3\CMS\Core\SingletonInterface {
         * @return Collection\AbstractFileCollection
         */
        public function createCollectionObject(array $collectionData) {
-               switch ($collectionData['type']) {
-                       case 'static':
-                               $collection = Collection\StaticFileCollection::create($collectionData);
-                               break;
-                       case 'folder':
-                               $collection = Collection\FolderBasedFileCollection::create($collectionData);
-                               break;
-                       case 'category':
-                               $collection = Collection\CategoryBasedFileCollection::create($collectionData);
-                               break;
-                       default:
-                               $collection = NULL;
-               }
-               return $collection;
+               /** @var $registry Collection\FileCollectionRegistry */
+               $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Collection\\FileCollectionRegistry');
+               $class = $registry->getFileCollectionClass($collectionData['type']);
+
+               return $class::create($collectionData);
        }
 
        /**