[!!!][~TASK] Extbase (Configuration): Major rework of the ConfigurationManager
authorBastian Waidelich <bastian@typo3.org>
Mon, 15 Nov 2010 21:55:25 +0000 (21:55 +0000)
committerBastian Waidelich <bastian@typo3.org>
Mon, 15 Nov 2010 21:55:25 +0000 (21:55 +0000)
Configuration of controllers and actions is now stored in a global registry
($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']). But you
should never access this directly. Instead always retrieve the frameworkConfiguration
from the ConfigurationManager.
Inserting an Extbase plugin is now as simple as:
lib.foo = USER
lib.foo {
  userFunc = tx_extbase_core_bootstrap->run
  extensionName = YourExtension
  pluginName = YourPlugin
}

This is not really a breaking change as it does not change the public API. But it's not unlikely that it changes the behavior of your Extension in case you modified the TypoScript, that is generated by Tx_Extbase_Utility_Extension::configurePlugin().

NOTE: Unit tests of Extbase and Fluid v4 are broken currently. We'll be fixing those asap

typo3/sysext/extbase/Classes/Configuration/AbstractConfigurationManager.php
typo3/sysext/extbase/Classes/Configuration/BackendConfigurationManager.php
typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php
typo3/sysext/extbase/Classes/MVC/Web/FrontendRequestHandler.php
typo3/sysext/extbase/Classes/MVC/Web/RequestBuilder.php
typo3/sysext/extbase/Classes/Utility/Extension.php

index 7dab028..e8c5e84 100644 (file)
@@ -47,13 +47,6 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager implements
         */
        protected $contentObject;
 
-       /**
-        * The TypoScript parser
-        *
-        * @var t3lib_TSparser
-        */
-       protected $typoScriptParser;
-
        /**
         * @var Tx_Extbase_Object_ObjectManagerInterface
         */
@@ -84,7 +77,6 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager implements
         */
        public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
                $this->objectManager = $objectManager;
-               $this->typoScriptParser = t3lib_div::makeInstance('t3lib_TSparser');
        }
 
        /**
@@ -115,7 +107,7 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager implements
 
                $this->extensionName = $configuration['extensionName'];
                $this->pluginName = $configuration['pluginName'];
-               $this->configuration = $configuration;
+               $this->configuration = Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($configuration);
        }
 
        /**
@@ -131,10 +123,10 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager implements
        public function getConfiguration($extensionName = NULL, $pluginName = NULL) {
                // 1st level cache
                if ($extensionName !== NULL) {
-                       $configurationCacheKey = strtolower($extensionName);
-                       if ($pluginName !== NULL) {
-                               $configurationCacheKey .= '_' . strtolower($pluginName);
+                       if ($pluginName === NULL) {
+                               throw new Tx_Extbase_Configuration_Exception('You\'ll have to specify either both, extensionName and pluginName, or neither.', 1289852422);
                        }
+                       $configurationCacheKey = strtolower($extensionName . '_' . $pluginName);
                } else {
                        $configurationCacheKey = strtolower($this->extensionName . '_' . $this->pluginName);
                }
@@ -142,41 +134,23 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager implements
                        return $this->configurationCache[$configurationCacheKey];
                }
 
-               $frameworkConfiguration = array();
-               $frameworkConfiguration['persistence']['storagePid'] = self::DEFAULT_BACKEND_STORAGE_PID;
+               $frameworkConfiguration = $this->getExtbaseConfiguration();
+               if (!isset($frameworkConfiguration['persistence']['storagePid'])) {
+                       $frameworkConfiguration['persistence']['storagePid'] = self::DEFAULT_BACKEND_STORAGE_PID;
+               }
 
-               $setup = $this->getTypoScriptSetup();
                if ($extensionName !== NULL) {
-                       $pluginConfiguration = $setup['plugin.']['tx_' . strtolower($extensionName) . '.'];
-                       if ($pluginName !== NULL) {
-                               $pluginSignature = strtolower($extensionName . '_' . $pluginName);
-                               if (is_array($setup['plugin.']['tx_' . $pluginSignature . '.'])) {
-                                       $pluginConfiguration = t3lib_div::array_merge_recursive_overrule($pluginConfiguration, $setup['plugin.']['tx_' . $pluginSignature . '.']);
-                               }
-                       }
+                       $pluginConfiguration = $this->getPluginConfiguration($extensionName, $pluginName);
+                       $pluginConfiguration['controllerConfiguration'] = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName][$pluginName]['controllers'];
                } else {
-                       $pluginConfiguration = $this->configuration;
-               }
-               $extbaseConfiguration = $setup['config.']['tx_extbase.'];
-               if (is_array($extbaseConfiguration)) {
-                       $extbaseConfiguration = Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($extbaseConfiguration);
-                       $frameworkConfiguration = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration, $extbaseConfiguration);
-               }
-
-               if (isset($pluginConfiguration['settings'])) {
-                       $pluginConfiguration = $this->resolveTyposcriptReference($pluginConfiguration, 'settings');
-               }
-               if (!is_array($pluginConfiguration['settings.'])) $pluginConfiguration['settings.'] = array(); // We expect that the settings are arrays on various places
-               if (isset($pluginConfiguration['persistence'])) {
-                       $pluginConfiguration = $this->resolveTyposcriptReference($pluginConfiguration, 'persistence');
-               }
-               if (isset($pluginConfiguration['view'])) {
-                       $pluginConfiguration = $this->resolveTyposcriptReference($pluginConfiguration, 'view');
-               }
-               if (isset($pluginConfiguration['_LOCAL_LANG'])) {
-                       $pluginConfiguration = $this->resolveTyposcriptReference($pluginConfiguration, '_LOCAL_LANG');
+                       $pluginConfiguration = $this->getPluginConfiguration($this->extensionName, $this->pluginName);
+                       $pluginConfiguration = t3lib_div::array_merge_recursive_overrule($pluginConfiguration, $this->configuration);
+                       $pluginConfiguration['controllerConfiguration'] = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$this->extensionName][$this->pluginName]['controllers'];
+                       if (isset($this->configuration['switchableControllerActions'])) {
+                               $this->overrideSwitchableControllerActions($pluginConfiguration, $this->configuration['switchableControllerActions']);
+                       }
                }
-               $frameworkConfiguration = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration, Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($pluginConfiguration));
+               $frameworkConfiguration = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration, $pluginConfiguration);
 
                // only load context specific configuration when retrieving configuration of the current plugin
                if ($extensionName === NULL || ($extensionName === $this->extensionName && $pluginName === $this->pluginName)) {
@@ -188,6 +162,59 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager implements
                return $frameworkConfiguration;
        }
 
+       /**
+        * Returns the TypoScript configuration found in config.tx_extbase
+        *
+        * @return array
+        */
+       protected function getExtbaseConfiguration() {
+               $setup = $this->getTypoScriptSetup();
+               $extbaseConfiguration = array();
+               if (isset($setup['config.']['tx_extbase.'])) {
+                       $extbaseConfiguration = Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($setup['config.']['tx_extbase.']);
+               }
+               return $extbaseConfiguration;
+       }
+
+       /**
+        * Returns the TypoScript configuration found in plugin.tx_yourextension_yourplugin
+        * merged with the global configuration of your extension from plugin.tx_yourextension
+        *
+        * @param string $extensionName
+        * @param string $pluginName
+        * @return array
+        */
+       protected function getPluginConfiguration($extensionName, $pluginName) {
+               $setup = $this->getTypoScriptSetup();
+               $pluginConfiguration = array();
+               if (is_array($setup['plugin.']['tx_' . strtolower($extensionName) . '.'])) {
+                       $pluginConfiguration = Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($setup['plugin.']['tx_' . strtolower($extensionName) . '.']);
+               }
+               $pluginSignature = strtolower($extensionName . '_' . $pluginName);
+               if (is_array($setup['plugin.']['tx_' . $pluginSignature . '.'])) {
+                       $pluginConfiguration = t3lib_div::array_merge_recursive_overrule($pluginConfiguration, Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($setup['plugin.']['tx_' . $pluginSignature . '.']));
+               }
+               return $pluginConfiguration;
+       }
+
+       /**
+        * @param array $frameworkConfiguration
+        * @param array $overriddenSwitchableControllerActions in the format array('Controller1' => array('action1', 'action2'), 'Controller2' => ...)
+        * @return void
+        */
+       protected function overrideSwitchableControllerActions(array &$frameworkConfiguration, array $switchableControllerActions) {
+               $overriddenSwitchableControllerActions = array();
+               foreach ($switchableControllerActions as $controllerName => $actions) {
+                       $overriddenSwitchableControllerActions[$controllerName] = array('actions' => $actions);
+                       $nonCacheableActions = $frameworkConfiguration['controllerConfiguration'][$controllerName]['nonCacheableActions'];
+                       $overriddenNonCacheableActions = array_intersect($nonCacheableActions, $actions);
+                       if (!empty($overriddenNonCacheableActions)) {
+                               $overriddenSwitchableControllerActions[$controllerName]['nonCacheableActions'] = $overriddenNonCacheableActions;
+                       }
+               }
+               $frameworkConfiguration['controllerConfiguration'] = $overriddenSwitchableControllerActions;
+       }
+
        /**
         * The context specific configuration returned by this method
         * will override the framework configuration which was
@@ -199,7 +226,7 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager implements
         * @param array $frameworkConfiguration The framework configuration until now
         * @return array context specific configuration which will override the configuration obtained by TypoScript
         */
-       abstract protected function getContextSpecificFrameworkConfiguration($frameworkConfiguration);
+       abstract protected function getContextSpecificFrameworkConfiguration(array $frameworkConfiguration);
 
        /**
         * Returns TypoScript Setup array from current Environment.
@@ -207,26 +234,5 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager implements
         * @return array the TypoScript setup
         */
        abstract protected function getTypoScriptSetup();
-
-       /**
-        * Resolves the TypoScript reference for $pluginConfiguration[$setting].
-        * In case the setting is a string and starts with "<", we know that this is a TypoScript reference which
-        * needs to be resolved separately.
-        *
-        * @param array $pluginConfiguration The whole plugin configuration
-        * @param string $setting The key inside the $pluginConfiguration to check
-        * @return array The modified plugin configuration
-        */
-       protected function resolveTyposcriptReference($pluginConfiguration, $setting) {
-               if (is_string($pluginConfiguration[$setting]) && substr($pluginConfiguration[$setting], 0, 1) === '<') {
-                       $key = trim(substr($pluginConfiguration[$setting], 1));
-                       $setup = $this->getTypoScriptSetup();
-                       list(, $newValue) = $this->typoScriptParser->getVal($key, $setup);
-
-                       unset($pluginConfiguration[$setting]);
-                       $pluginConfiguration[$setting . '.'] = $newValue;
-               }
-               return $pluginConfiguration;
-       }
 }
 ?>
\ No newline at end of file
index ba60f39..d17b855 100644 (file)
@@ -91,7 +91,7 @@ class Tx_Extbase_Configuration_BackendConfigurationManager extends Tx_Extbase_Co
         * We do not want to override anything in the backend.
         * @return array
         */
-       protected function getContextSpecificFrameworkConfiguration($frameworkConfiguration) {
+       protected function getContextSpecificFrameworkConfiguration(array $frameworkConfiguration) {
                return $frameworkConfiguration;
        }
 }
index 9b80c0d..fb7cda8 100644 (file)
@@ -50,7 +50,7 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_C
         * @param array $frameworkConfiguration The framework configuration to modify
         * @return array the modified framework configuration
         */
-       protected function getContextSpecificFrameworkConfiguration($frameworkConfiguration) {
+       protected function getContextSpecificFrameworkConfiguration(array $frameworkConfiguration) {
                $frameworkConfiguration = $this->overrideStoragePidIfStartingPointIsSet($frameworkConfiguration);
                $frameworkConfiguration = $this->overrideConfigurationFromPlugin($frameworkConfiguration);
                $frameworkConfiguration = $this->overrideConfigurationFromFlexform($frameworkConfiguration);
@@ -65,7 +65,7 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_C
         * @param array $frameworkConfiguration the framework configurations
         * @return array the framework configuration with overriden storagePid
         */
-       protected function overrideStoragePidIfStartingPointIsSet($frameworkConfiguration) {
+       protected function overrideStoragePidIfStartingPointIsSet(array $frameworkConfiguration) {
                $pages = $this->contentObject->data['pages'];
                if (is_string($pages) && strlen($pages) > 0) {
                        $list = array();
@@ -171,7 +171,7 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_C
         * @param string $configurationPartName The name of the configuration part which should be merged.
         * @return array the processed framework configuration
         */
-       protected function mergeConfigurationIntoFrameworkConfiguration($frameworkConfiguration, $configuration, $configurationPartName) {
+       protected function mergeConfigurationIntoFrameworkConfiguration(array $frameworkConfiguration, array $configuration, $configurationPartName) {
                if (is_array($frameworkConfiguration[$configurationPartName]) && is_array($configuration[$configurationPartName])) {
                        $frameworkConfiguration[$configurationPartName] = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration[$configurationPartName], $configuration[$configurationPartName]);
                }
@@ -182,46 +182,30 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_C
        /**
         * Overrides the switchable controller actions from the flexform.
         *
-        * @param $frameworkConfiguration The original framework configuration
-        * @param $flexformConfiguration The full flexform configuration
+        * @param array $frameworkConfiguration The original framework configuration
+        * @param array $flexformConfiguration The full flexform configuration
         * @return array the modified framework configuration, if needed
         * @todo: Check that the controller has been before inside the switchableControllerActions.
         */
-       protected function overrideSwitchableControllerActionsFromFlexform($frameworkConfiguration, $flexformConfiguration) {
-               if (isset($flexformConfiguration['switchableControllerActions']) && !is_array($flexformConfiguration['switchableControllerActions'])) {
-
-                       // As "," is the flexform field value delimiter, we need to use ";" as in-field delimiter. That's why we need to replace ; by  , first.
-                       $switchableControllerActionPartsFromFlexform = t3lib_div::trimExplode(',', str_replace(';', ',', $flexformConfiguration['switchableControllerActions']), TRUE);
+       protected function overrideSwitchableControllerActionsFromFlexform(array $frameworkConfiguration, array $flexformConfiguration) {
+               if (!isset($flexformConfiguration['switchableControllerActions']) || is_array($flexformConfiguration['switchableControllerActions'])) {
+                       return $frameworkConfiguration;
+               }
 
-                       $newSwitchableControllerActionsFromFlexform = array();
-                       foreach ($switchableControllerActionPartsFromFlexform as $switchableControllerActionPartFromFlexform) {
-                               list($controller, $action) = explode('->', $switchableControllerActionPartFromFlexform);
-                               if (empty($controller) || empty($action)) {
-                                       throw new Tx_Extbase_Configuration_Exception_ParseError('Controller or action were empty when overriding switchableControllerActions from flexform.', 1257146403);
-                               }
+               // As "," is the flexform field value delimiter, we need to use ";" as in-field delimiter. That's why we need to replace ; by  , first.
+               $switchableControllerActionPartsFromFlexform = t3lib_div::trimExplode(',', str_replace(';', ',', $flexformConfiguration['switchableControllerActions']), TRUE);
 
-                               $newSwitchableControllerActionsFromFlexform[$controller][] = $action;
+               $newSwitchableControllerActionsFromFlexform = array();
+               foreach ($switchableControllerActionPartsFromFlexform as $switchableControllerActionPartFromFlexform) {
+                       list($controller, $action) = explode('->', $switchableControllerActionPartFromFlexform);
+                       if (empty($controller) || empty($action)) {
+                               throw new Tx_Extbase_Configuration_Exception_ParseError('Controller or action were empty when overriding switchableControllerActions from flexform.', 1257146403);
                        }
+                       $newSwitchableControllerActionsFromFlexform[$controller][] = $action;
+               }
 
-                       if (count($newSwitchableControllerActionsFromFlexform)) {
-                               $overriddenSwitchableControllerActions = array();
-                               foreach ($newSwitchableControllerActionsFromFlexform as $controller => $actions) {
-                                       $overriddenSwitchableControllerActions[$controller] = array(
-                                               'controller' => $controller,
-                                               'actions' => implode(',', $actions)
-                                       );
-                                       $nonCacheableActions = t3lib_div::trimExplode(',', $frameworkConfiguration['switchableControllerActions'][$controller]['nonCacheableActions']);
-                                       $overriddenNonCacheableActions = array_intersect($nonCacheableActions, $actions);
-                                       if (!empty($overriddenNonCacheableActions)) {
-                                               $overriddenSwitchableControllerActions[$controller]['nonCacheableActions'] = implode(',', $overriddenNonCacheableActions);
-                                       }
-                               }
-                               $frameworkConfiguration['switchableControllerActions'] = $overriddenSwitchableControllerActions;
-
-                               // We want the first controller/action be the default.
-                               unset($frameworkConfiguration['controller']);
-                               unset($frameworkConfiguration['action']);
-                       }
+               if (count($newSwitchableControllerActionsFromFlexform)) {
+                       $this->overrideSwitchableControllerActions($frameworkConfiguration, $newSwitchableControllerActionsFromFlexform);
                }
                return $frameworkConfiguration;
        }
index 456ab2b..15eecce 100644 (file)
@@ -92,8 +92,8 @@ class Tx_Extbase_MVC_Web_FrontendRequestHandler extends Tx_Extbase_MVC_Web_Abstr
         */
        protected function isCacheable($controllerName, $actionName) {
                $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
-               if (isset($frameworkConfiguration['switchableControllerActions'][$controllerName]['nonCacheableActions'])
-                       && in_array($actionName, t3lib_div::trimExplode(',', $frameworkConfiguration['switchableControllerActions'][$controllerName]['nonCacheableActions']))) {
+               if (isset($frameworkConfiguration['controllerConfiguration'][$controllerName]['nonCacheableActions'])
+                       && in_array($actionName, $frameworkConfiguration['controllerConfiguration'][$controllerName]['nonCacheableActions'])) {
                                return FALSE;
                        }
                return TRUE;
index 7d5c99d..d54ebce 100644 (file)
@@ -35,6 +35,7 @@
  * @scope prototype
  */
 class Tx_Extbase_MVC_Web_RequestBuilder implements t3lib_Singleton {
+
        /**
         * @var Tx_Extbase_Object_ObjectManagerInterface
         */
@@ -52,28 +53,28 @@ class Tx_Extbase_MVC_Web_RequestBuilder implements t3lib_Singleton {
         *
         * @var string
         */
-       protected $extensionName = 'Extbase';
+       protected $extensionName;
 
        /**
         * The default controller name
         *
         * @var string
         */
-       protected $defaultControllerName = 'Standard';
+       protected $defaultControllerName;
 
        /**
         * The default action of the default controller
         *
         * @var string
         */
-       protected $defaultActionName = 'index';
+       protected $defaultActionName;
 
        /**
         * The allowed actions of the controller. This actions can be called via $_GET and $_POST.
         *
         * @var array
         */
-       protected $allowedControllerActions;
+       protected $allowedControllerActions = array();
 
        /**
         * @var Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager
@@ -102,32 +103,23 @@ class Tx_Extbase_MVC_Web_RequestBuilder implements t3lib_Singleton {
         */
        protected function loadDefaultValues() {
                $configuration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
-               if (!empty($configuration['pluginName'])) {
-                       $this->pluginName = $configuration['pluginName'];
-               }
-               if (!empty($configuration['extensionName'])) {
-                       $this->extensionName = $configuration['extensionName'];
-               }
-               if (!empty($configuration['controller'])) {
-                       $this->defaultControllerName = $configuration['controller'];
-               } elseif (is_array($configuration['switchableControllerActions'])) {
-                       $firstControllerActions = current($configuration['switchableControllerActions']);
-                       $this->defaultControllerName = $firstControllerActions['controller'];
+               if (empty($configuration['extensionName'])) {
+                       throw new Tx_Extbase_MVC_Exception('"extensionName" is not properly configured. Request can\'t be dispatched!', 1289843275);
                }
-               if (!empty($configuration['action'])) {
-                       $this->defaultActionName = $configuration['action'];
-               } elseif (is_array($configuration['switchableControllerActions'])) {
-                       $firstControllerActions = current($configuration['switchableControllerActions']);
-                       $this->defaultActionName = array_shift(t3lib_div::trimExplode(',', $firstControllerActions['actions'], TRUE));
+               if (empty($configuration['pluginName'])) {
+                       throw new Tx_Extbase_MVC_Exception('"pluginName" is not properly configured. Request can\'t be dispatched!', 1289843277);
                }
+               $this->extensionName = $configuration['extensionName'];
+               $this->pluginName = $configuration['pluginName'];
+
+               $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+               $controllerConfiguration = $frameworkConfiguration['controllerConfiguration'];
+               $this->defaultControllerName = current(array_keys($controllerConfiguration));
+               $this->defaultActionName = current($controllerConfiguration[$this->defaultControllerName]['actions']);
+
                $allowedControllerActions = array();
-               if (is_array($configuration['switchableControllerActions'])) {
-                       foreach ($configuration['switchableControllerActions'] as $controller => $controllerConfiguration) {
-                               $controllerActions = t3lib_div::trimExplode(',', $controllerConfiguration['actions'], TRUE);
-                               foreach ($controllerActions as $actionName) {
-                                       $allowedControllerActions[$controller][] = $actionName;
-                               }
-                       }
+               foreach ($controllerConfiguration as $controllerName => $controllerActions) {
+                       $allowedControllerActions[$controllerName] = $controllerActions['actions'];
                }
                $this->allowedControllerActions = $allowedControllerActions;
        }
index 4c103db..5216c6e 100644 (file)
@@ -60,29 +60,17 @@ class Tx_Extbase_Utility_Extension {
                }
                $extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionName)));
                $pluginSignature = strtolower($extensionName) . '_' . strtolower($pluginName);
+               if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName][$pluginName])) {
+                       $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName][$pluginName] = array();
+               }
 
-               $controllers = '';
-               foreach ($controllerActions as $controller => $actionsList) {
-                       $controllers .= '
-               ' . $controller . '.actions = ' . $actionsList;
-                       if (!empty($nonCacheableControllerActions[$controller])) {
-                               $controllers .= '
-               ' . $controller . '.nonCacheableActions = ' . $nonCacheableControllerActions[$controller];
+               foreach ($controllerActions as $controllerName => $actionsList) {
+                       $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName][$pluginName]['controllers'][$controllerName] = array('actions' => t3lib_div::trimExplode(',', $actionsList));
+                       if (!empty($nonCacheableControllerActions[$controllerName])) {
+                               $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName][$pluginName]['controllers'][$controllerName]['nonCacheableActions'] = t3lib_div::trimExplode(',', $nonCacheableControllerActions[$controllerName]);
                        }
                }
 
-               $switchableControllerActions = '
-       switchableControllerActions {' . $controllers . '
-       }';
-
-               reset($controllerActions);
-               $defaultController = key($controllerActions);
-               $controller = '
-       controller = ' . $defaultController;
-               $defaultAction = array_shift(t3lib_div::trimExplode(',', current($controllerActions)));
-               $action = '
-       action = ' . $defaultAction;
-
                $pluginTemplate = 'plugin.tx_' . strtolower($extensionName) . ' {
        settings {
        }
@@ -107,16 +95,8 @@ class Tx_Extbase_Utility_Extension {
 tt_content.list.20.' . $pluginSignature . ' = USER
 tt_content.list.20.' . $pluginSignature . ' {
        userFunc = tx_extbase_core_bootstrap->run
-       pluginName = ' . $pluginName . '
        extensionName = ' . $extensionName . '
-       ' . $controller .
-       $action .
-       $switchableControllerActions . '
-
-       settings =< plugin.tx_' . strtolower($extensionName) . '.settings
-       persistence =< plugin.tx_' . strtolower($extensionName) . '.persistence
-       view =< plugin.tx_' . strtolower($extensionName) . '.view
-       _LOCAL_LANG =< plugin.tx_' . strtolower($extensionName) . '._LOCAL_LANG
+       pluginName = ' . $pluginName . '
 }');
 
                t3lib_extMgm::addTypoScript($extensionName, 'setup', '
@@ -514,24 +494,21 @@ tt_content.list.20.' . $pluginSignature . ' {
         * @return string name of the target plugin (UpperCamelCase) or NULL if no matching plugin configuration was found
         */
        static public function getPluginNameByAction($extensionName, $controllerName, $actionName) {
-               if (!isset($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']) || !is_array($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.'])) {
+               // TODO use ConfigurationManager to retrieve controllerConfiguration
+               if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName])) {
                        return NULL;
                }
                $pluginNames = array();
-               foreach($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.'] as $pluginConfiguration) {
-                       if (!is_array($pluginConfiguration) || !isset($pluginConfiguration['switchableControllerActions.']) || !isset($pluginConfiguration['extensionName'])) {
-                               continue;
-                       }
-                       if (strtolower($extensionName) !== strtolower($pluginConfiguration['extensionName'])) {
+               foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName] as $pluginName => $pluginConfiguration) {
+                       if (!is_array($pluginConfiguration['controllers'])) {
                                continue;
                        }
-                       foreach($pluginConfiguration['switchableControllerActions.'] as $controller => $switchableControllerActions) {
-                               if (strtolower(rtrim($controller, '.')) !== strtolower($controllerName)) {
+                       foreach($pluginConfiguration['controllers'] as $pluginControllerName => $pluginControllerActions) {
+                               if (strtolower($pluginControllerName) !== strtolower($controllerName)) {
                                        continue;
                                }
-                               $actions = t3lib_div::trimExplode(',', $switchableControllerActions['actions']);
-                               if (in_array($actionName, $actions)) {
-                                       $pluginNames[] = $pluginConfiguration['pluginName'];
+                               if (in_array($actionName, $pluginControllerActions['actions'])) {
+                                       $pluginNames[] = $pluginName;
                                }
                        }
                }