[+BUGFIX] Extbase (Configuration): Fixed the configuration manager so that the storag...
authorSebastian Kurfürst <sebastian@typo3.org>
Wed, 16 Sep 2009 09:56:09 +0000 (09:56 +0000)
committerSebastian Kurfürst <sebastian@typo3.org>
Wed, 16 Sep 2009 09:56:09 +0000 (09:56 +0000)
typo3/sysext/extbase/Classes/Configuration/AbstractConfigurationManager.php
typo3/sysext/extbase/Classes/Configuration/BackendConfigurationManager.php
typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php

index adb43f1..ab05878 100644 (file)
@@ -113,9 +113,22 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
                }
                $frameworkConfiguration = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration, Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($pluginConfiguration));
 
+               $frameworkConfiguration = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration, $this->getContextSpecificFrameworkConfiguration());
                return $frameworkConfiguration;
        }
 
+       /**
+        * The context specific configuration returned by this method
+        * will override the framework configuration which was
+        * obtained from TypoScript. This can be used f.e. to override the storagePid
+        * with the value set inside the Plugin Instance.
+        *
+        * WARNING: Make sure this method ALWAYS returns an array!
+        *
+        * @return array context specific configuration which will override the configuration obtained by TypoScript
+        */
+       abstract protected function getContextSpecificFrameworkConfiguration();
+
        /**
         * Returns TypoScript Setup array from current Environment.
         *
index 0278788..6f77fe6 100644 (file)
@@ -86,5 +86,13 @@ class Tx_Extbase_Configuration_BackendConfigurationManager extends Tx_Extbase_Co
                        // fallback
                return self::DEFAULT_BACKEND_STORAGE_PID;
        }
+
+       /**
+        * We do not want to override anything in the backend.
+        * @return array
+        */
+       protected function getContextSpecificFrameworkConfiguration() {
+               return array();
+       }
 }
 ?>
index 002e5ab..b9616df 100644 (file)
@@ -54,5 +54,23 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_C
        public function loadTypoScriptSetup() {
                return $GLOBALS['TSFE']->tmpl->setup;
        }
+
+       /**
+        * The storage PID should be determined by the "Startingpoint" setting
+        * in the Plugin Configuration.
+        *
+        * @return array
+        */
+       protected function getContextSpecificFrameworkConfiguration() {
+               if (is_string($this->contentObject->data['pages']) && strlen($this->contentObject->data['pages']) > 0) {
+                       return array(
+                               'persistence' => array(
+                                       'storagePid' => $this->contentObject->data['pages']
+                               )
+                       );
+               }
+               return array();
+       }
+
 }
 ?>