[FEATURE] Recursive starting point/storage pid via TypoScript
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Configuration / FrontendConfigurationManager.php
index a611625..d850685 100644 (file)
@@ -221,6 +221,29 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst
                }
                return $frameworkConfiguration;
        }
+
+       /**
+        * Returns a comma separated list of storagePid that are below a certain storage pid.
+        *
+        * @param string $storagePid Storage PID to start at; multiple PIDs possible as comma-separated list
+        * @param integer $recursionDepth Maximum number of levels to search, 0 to disable recursive lookup
+        * @return string storage PIDs
+        */
+       protected function getRecursiveStoragePids($storagePid, $recursionDepth = 0) {
+               if ($recursionDepth <= 0) {
+                       return $storagePid;
+               }
+
+               $recursiveStoragePids = '';
+               $storagePids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $storagePid);
+               foreach ($storagePids as $startPid) {
+                       $pids = $this->getContentObject()->getTreeList($startPid, $recursionDepth, 0);
+                       if (strlen($pids) > 0) {
+                               $recursiveStoragePids .= $pids . ',';
+                       }
+               }
+               return rtrim($recursiveStoragePids, ',');
+       }
 }
 
 ?>
\ No newline at end of file