[FEATURE] Recursive starting point/storage pid via TypoScript
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Configuration / AbstractConfigurationManager.php
index b9f1942..99b1e57 100755 (executable)
@@ -165,17 +165,26 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton
                if ($extensionName === NULL || $extensionName === $this->extensionName && $pluginName === $this->pluginName) {
                        $frameworkConfiguration = $this->getContextSpecificFrameworkConfiguration($frameworkConfiguration);
                }
                if ($extensionName === NULL || $extensionName === $this->extensionName && $pluginName === $this->pluginName) {
                        $frameworkConfiguration = $this->getContextSpecificFrameworkConfiguration($frameworkConfiguration);
                }
-               if (!empty($frameworkConfiguration['persistence']['storagePid']) && is_array($frameworkConfiguration['persistence']['storagePid'])) {
-                       /** We simulate the frontend to enable the use of cObjects in
-                       stdWrap. Than we convert the configuration to normal TypoScript
-                       and apply the stdWrap to the storagePid */
-                       if (TYPO3_MODE !== 'FE') {
-                               \TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility::simulateFrontendEnvironment($this->getContentObject());
+
+               if (!empty($frameworkConfiguration['persistence']['storagePid'])) {
+                       if (is_array($frameworkConfiguration['persistence']['storagePid'])) {
+                                       /**
+                                       * We simulate the frontend to enable the use of cObjects in
+                                       * stdWrap. Than we convert the configuration to normal TypoScript
+                                       * and apply the stdWrap to the storagePid
+                                       */
+                               if (TYPO3_MODE !== 'FE') {
+                                       Tx_Extbase_Utility_FrontendSimulator::simulateFrontendEnvironment($this->getContentObject());
+                               }
+                               $conf = $this->typoScriptService->convertPlainArrayToTypoScriptArray($frameworkConfiguration['persistence']);
+                               $frameworkConfiguration['persistence']['storagePid'] = $GLOBALS['TSFE']->cObj->stdWrap($conf['storagePid'], $conf['storagePid.']);
+                               if (TYPO3_MODE !== 'FE') {
+                                       Tx_Extbase_Utility_FrontendSimulator::resetFrontendEnvironment();
+                               }
                        }
                        }
-                       $configuration = $this->typoScriptService->convertPlainArrayToTypoScriptArray($frameworkConfiguration['persistence']);
-                       $frameworkConfiguration['persistence']['storagePid'] = $GLOBALS['TSFE']->cObj->stdWrap($configuration['storagePid'], $configuration['storagePid.']);
-                       if (TYPO3_MODE !== 'FE') {
-                               \TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility::resetFrontendEnvironment();
+
+                       if (!empty($frameworkConfiguration['persistence']['recursive'])) {
+                               $frameworkConfiguration['persistence']['storagePid'] = $this->getRecursiveStoragePids($frameworkConfiguration['persistence']['storagePid'], (int) $frameworkConfiguration['persistence']['recursive']);
                        }
                }
                // 1st level cache
                        }
                }
                // 1st level cache
@@ -274,6 +283,17 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton
         * @return array
         */
        abstract protected function getSwitchableControllerActions($extensionName, $pluginName);
         * @return array
         */
        abstract protected function getSwitchableControllerActions($extensionName, $pluginName);
+
+       /**
+        * The implementation of the methods to return a 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
+        */
+       abstract protected function getRecursiveStoragePids($storagePid, $recursionDepth = 0);
+
 }
 
 ?>
\ No newline at end of file
 }
 
 ?>
\ No newline at end of file