[!!!][+FEATURE] Extbase (Configuration): Made it possible to override controller...
authorSebastian Kurfürst <sebastian@typo3.org>
Tue, 3 Nov 2009 10:48:49 +0000 (10:48 +0000)
committerSebastian Kurfürst <sebastian@typo3.org>
Tue, 3 Nov 2009 10:48:49 +0000 (10:48 +0000)
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/Configuration/Source/FlexFormSource.php [deleted file]
typo3/sysext/extbase/Classes/Configuration/Source/SourceInterface.php [deleted file]
typo3/sysext/extbase/Classes/Configuration/Source/TypoScriptSource.php [deleted file]
typo3/sysext/extbase/Classes/Dispatcher.php
typo3/sysext/extbase/Classes/MVC/Web/RequestBuilder.php
typo3/sysext/extbase/Classes/Utility/Extension.php

index e753b47..6ec5693 100644 (file)
@@ -51,35 +51,11 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
        protected $settings;
 
        /**
-        * The configuration source instances used for loading the raw configuration
-        *
-        * @var array
-        */
-       protected $configurationSources = array();
-
-       /**
         * Constructs the configuration manager
         *
-        * @param array $configurationSources An array of configuration sources
         */
-       public function __construct($configurationSources = NULL) {
+       public function __construct() {
                $this->typoScriptParser = t3lib_div::makeInstance('t3lib_TSparser');
-               if (is_array($configurationSources)) {
-                       $this->configurationSources = $configurationSources;
-               }
-       }
-
-       /**
-        * Returns an array with the settings defined for the specified extension.
-        *
-        * @param string $extensionName Name of the extension to return the settings for
-        * @return array The settings of the specified extension
-        */
-       public function getSettings($extensionName) {
-               if (empty($this->settings[$extensionName])) {
-                       $this->loadSettings($extensionName);
-               }
-               return $this->settings[$extensionName];
        }
 
        /**
@@ -104,6 +80,7 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
 
                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');
@@ -114,9 +91,10 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
                if (isset($pluginConfiguration['_LOCAL_LANG'])) {
                        $pluginConfiguration = $this->resolveTyposcriptReference($pluginConfiguration, '_LOCAL_LANG');
                }
+
                $frameworkConfiguration = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration, Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($pluginConfiguration));
 
-               $frameworkConfiguration = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration, $this->getContextSpecificFrameworkConfiguration());
+               $frameworkConfiguration = $this->getContextSpecificFrameworkConfiguration($frameworkConfiguration);
                return $frameworkConfiguration;
        }
 
@@ -128,9 +106,10 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
         *
         * WARNING: Make sure this method ALWAYS returns an array!
         *
+        * @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();
+       abstract protected function getContextSpecificFrameworkConfiguration($frameworkConfiguration);
 
        /**
         * Returns TypoScript Setup array from current Environment.
@@ -159,26 +138,5 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
                }
                return $pluginConfiguration;
        }
-
-       /**
-        * Loads the settings defined in the specified extensions and merges them with
-        * those potentially existing in the global configuration folders.
-        *
-        * The result is stored in the configuration manager's settings registry
-        * and can be retrieved with the getSettings() method.
-        *
-        * @param string $extensionName
-        * @return void
-        * @see getSettings()
-        */
-       protected function loadSettings($extensionName) {
-               $settings = array();
-               foreach ($this->configurationSources as $configurationSource) {
-                       $settings = t3lib_div::array_merge_recursive_overrule($settings, $configurationSource->load($extensionName));
-               }
-               $this->settings[$extensionName] = $settings;
-       }
-
-
 }
-?>
+?>
\ No newline at end of file
index 6f77fe6..8156378 100644 (file)
@@ -91,8 +91,8 @@ class Tx_Extbase_Configuration_BackendConfigurationManager extends Tx_Extbase_Co
         * We do not want to override anything in the backend.
         * @return array
         */
-       protected function getContextSpecificFrameworkConfiguration() {
-               return array();
+       protected function getContextSpecificFrameworkConfiguration($frameworkConfiguration) {
+               return $frameworkConfiguration;
        }
 }
 ?>
index b9616df..04d9df2 100644 (file)
@@ -56,21 +56,152 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_C
        }
 
        /**
-        * The storage PID should be determined by the "Startingpoint" setting
-        * in the Plugin Configuration.
+        * Get context specific framework configuration.
+        * - Overrides storage PID with setting "Startingpoint"
+        * - merge flexform configuration, if needed
         *
-        * @return array
+        * @param array $frameworkConfiguration The framework configuration to modify
+        * @return array the modified framework configuration
         */
-       protected function getContextSpecificFrameworkConfiguration() {
-               if (is_string($this->contentObject->data['pages']) && strlen($this->contentObject->data['pages']) > 0) {
-                       return array(
+       protected function getContextSpecificFrameworkConfiguration($frameworkConfiguration) {
+               $frameworkConfiguration = $this->overrideStoragePidIfStartingPointIsSet($frameworkConfiguration);
+               $frameworkConfiguration = $this->overrideConfigurationFromFlexform($frameworkConfiguration);
+
+               return $frameworkConfiguration;
+       }
+
+       /**
+        * Overrides the storage PID settings, in case the "Startingpoint" settings
+        * is set in the plugin configuration.
+        *
+        * @param array $frameworkConfiguration the framework configurations
+        * @return array the framework configuration with overriden storagePid
+        */
+       protected function overrideStoragePidIfStartingPointIsSet($frameworkConfiguration) {
+               if (is_string($this->contentObject->data['pages'])
+                   && strlen($this->contentObject->data['pages']) > 0) {
+                       $frameworkConfiguration = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration, array(
                                'persistence' => array(
                                        'storagePid' => $this->contentObject->data['pages']
                                )
-                       );
+                       ));
+               }
+
+               return $frameworkConfiguration;
+       }
+
+       /**
+        * Overrides configuration settings from flexforms.
+        * This merges the whole flexform data, and overrides switchable controller actions.
+        *
+        * @param array the framework configuration
+        * @return array the framework configuration with overridden data from flexform
+        */
+       protected function overrideConfigurationFromFlexform(array $frameworkConfiguration) {
+               if (strlen($this->contentObject->data['pi_flexform']) > 0) {
+                       $flexformConfiguration = $this->convertFlexformContentToArray($this->contentObject->data['pi_flexform']);
+
+                       $frameworkConfiguration = $this->mergeConfigurationPartFromFlexformIntoFrameworkConfiguration($frameworkConfiguration, $flexformConfiguration, 'settings');
+                       $frameworkConfiguration = $this->mergeConfigurationPartFromFlexformIntoFrameworkConfiguration($frameworkConfiguration, $flexformConfiguration, 'persistence');
+                       $frameworkConfiguration = $this->mergeConfigurationPartFromFlexformIntoFrameworkConfiguration($frameworkConfiguration, $flexformConfiguration, 'view');
+
+                       $frameworkConfiguration = $this->overrideSwitchableControllerActionsFromFlexform($frameworkConfiguration, $flexformConfiguration);
+               }
+               return $frameworkConfiguration;
+       }
+
+       /**
+        * Parses the FlexForm content recursivly and converts it to an array
+        * The resulting array will be multi-dimensional, as a value "bla.blubb"
+        * results in two levels, and a value "bla.blubb.bla" results in three levels.
+        *
+        * Note: multi-language FlexForms are not supported yet
+        *
+        * @param string $flexFormContent FlexForm xml string
+        * @return array the processed array
+        */
+       protected function convertFlexformContentToArray($flexFormContent) {
+               $settings = array();
+               $languagePointer = 'lDEF';
+               $valuePointer = 'vDEF';
+
+               $flexFormArray = t3lib_div::xml2array($flexFormContent);
+               $flexFormArray = isset($flexFormArray['data']) ? $flexFormArray['data'] : array();
+               foreach(array_values($flexFormArray) as $languages) {
+                       if (!is_array($languages[$languagePointer])) {
+                               continue;
+                       }
+                       foreach($languages[$languagePointer] as $valueKey => $valueDefinition) {
+                               if (strpos($valueKey, '.') === false) {
+                                       $settings[$valueKey] = $valueDefinition[$valuePointer];
+                               } else {
+                                       $valueKeyParts = explode('.', $valueKey);
+                                       $currentNode =& $settings;
+                                       foreach ($valueKeyParts as $valueKeyPart) {
+                                               $currentNode =& $currentNode[$valueKeyPart];
+                                       }
+                                       $currentNode = $valueDefinition[$valuePointer];
+                               }
+                       }
+               }
+               return $settings;
+       }
+
+       /**
+        * Merge a configuration part from the flexform configuration to the framework configuration.
+        *
+        * @param array $frameworkConfiguration the framework configuration to merge the data on
+        * @param array $flexformConfiguration The full flexform configuration
+        * @param string $configurationPartName The name of the configuration part which should be merged.
+        * @return array the processed framework configuration
+        */
+       protected function mergeConfigurationPartFromFlexformIntoFrameworkConfiguration($frameworkConfiguration, $flexformConfiguration, $configurationPartName) {
+               if (is_array($flexformConfiguration[$configurationPartName])) {
+                       $frameworkConfiguration[$configurationPartName] = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration[$configurationPartName], $flexformConfiguration[$configurationPartName]);
                }
-               return array();
+               return $frameworkConfiguration;
        }
 
+
+       /**
+        * Overrides the switchable controller actions from the flexform.
+        *
+        * @param $frameworkConfiguration The original framework configuration
+        * @param $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']));
+
+                       $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)) {
+                               $frameworkConfiguration['switchableControllerActions'] = array();
+                               foreach ($newSwitchableControllerActionsFromFlexform as $controller => $actions) {
+                                       $frameworkConfiguration['switchableControllerActions'][] = array(
+                                               'controller' => $controller,
+                                               'actions' => implode(',', $actions)
+                                       );
+                               }
+
+                               // We want the first controller/action be the default.
+                               unset($frameworkConfiguration['controller']);
+                               unset($frameworkConfiguration['action']);
+                       }
+               }
+               return $frameworkConfiguration;
+       }
 }
-?>
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Configuration/Source/FlexFormSource.php b/typo3/sysext/extbase/Classes/Configuration/Source/FlexFormSource.php
deleted file mode 100644 (file)
index 7110da9..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3.
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Configuration source based on FlexForm settings
- *
- * @package Extbase
- * @subpackage Configuration\Source
- * @version $ID:$
- */
-class Tx_Extbase_Configuration_Source_FlexFormSource implements Tx_Extbase_Configuration_Source_SourceInterface {
-
-       /**
-        * XML FlexForm content
-        *
-        * @var string
-        **/
-       protected $flexFormContent;
-
-       /**
-        * Sets the flex form content
-        *
-        * @param string $flexFormContent Flexform content
-        * @return void
-        */
-       public function setFlexFormContent($flexFormContent) {
-               $this->flexFormContent = $flexFormContent;
-       }
-
-       /**
-        * Loads the specified FlexForm configuration  and returns its content in a
-        * configuration container. If the file does not exist or could not be loaded,
-        * the empty configuration container is returned.
-        *
-        * @param string $extensionName The extension name
-        * @return array
-        */
-       public function load($extensionName) {
-               $settings = array();
-               if (!empty($this->flexFormContent)) {
-                       $settings = $this->convertFlexFormContentToArray($this->flexFormContent);
-               }
-
-               return $settings;
-       }
-
-       /**
-        * Parses the FlexForm content recursivly and converts it to an array
-        * The resulting array will be one-dimensional. So make sure not to use the same key multiple times
-        * or it will be overwritten.
-        * Note: multi-language FlexForms are not supported yet
-        *
-        * @param string $flexFormContent FlexForm xml string
-        * @return array
-        */
-       protected function convertFlexFormContentToArray($flexFormContent) {
-               $settings = array();
-               $languagePointer = 'lDEF';
-               $valuePointer = 'vDEF';
-
-               $flexFormArray = t3lib_div::xml2array($flexFormContent);
-               $flexFormArray = isset($flexFormArray['data']) ? $flexFormArray['data'] : array();
-               foreach(array_values($flexFormArray) as $languages) {
-                       if (!is_array($languages[$languagePointer])) {
-                               continue;
-                       }
-                       foreach($languages[$languagePointer] as $valueKey => $valueDefinition) {
-                               $settings[$valueKey] = $valueDefinition[$valuePointer];
-                       }
-               }
-               return $settings;
-       }
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Configuration/Source/SourceInterface.php b/typo3/sysext/extbase/Classes/Configuration/Source/SourceInterface.php
deleted file mode 100644 (file)
index b19a6ba..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3.
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Contract for a configuration source
- *
- * @package Extbase
- * @subpackage Configuration
- * @version $ID:$
- */
-interface Tx_Extbase_Configuration_Source_SourceInterface {
-
-       /**
-        * Loads the specified configuration file and returns its content in a
-        * configuration container
-        *
-        * @param string $extensionName The extension name
-        * @return array
-        */
-       public function load($extensionName);
-}
-?>
diff --git a/typo3/sysext/extbase/Classes/Configuration/Source/TypoScriptSource.php b/typo3/sysext/extbase/Classes/Configuration/Source/TypoScriptSource.php
deleted file mode 100644 (file)
index c715ace..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3.
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Configuration source based on TS settings
- *
- * @package Extbase
- * @subpackage Configuration\Source
- * @version $ID:$
- */
-class Tx_Extbase_Configuration_Source_TypoScriptSource implements Tx_Extbase_Configuration_Source_SourceInterface {
-
-       /**
-        * Loads the specified TypoScript configuration file and returns its content in a
-        * configuration container. If the file does not exist or could not be loaded,
-        * the empty configuration container is returned.
-        *
-        * @param string $extensionName The extension name
-        * @return array The settings as array without trailing dots
-        */
-       public function load($extensionName) {
-               if (TYPO3_MODE === 'FE') {
-                       $settings = $this->loadFrontendSettings($extensionName);
-               } else {
-                       $settings = $this->loadBackendSettings($extensionName);
-               }
-               if (is_array($settings)) {
-                       $settings = Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($settings);
-               } else {
-                       $settings = array();
-               }
-               return $settings;
-       }
-
-       /**
-        * Loads the specified TypoScript configuration.
-        *
-        * @param string $extensionName The extension name
-        * @return array The settings as array without trailing dots
-        */
-       protected function loadFrontendSettings($extensionName) {
-               return $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_' . strtolower($extensionName) . '.']['settings.'];
-       }
-
-       /**
-        * Loads the specified TypoScript configuration.
-        *
-        * @param string $extensionName The extension name
-        * @return array The settings as array without trailing dots
-        */
-       protected function loadBackendSettings($extensionName) {
-               $configurationManager = t3lib_div::makeInstance('Tx_Extbase_Configuration_BackendConfigurationManager');
-               $typoScriptSetup = $configurationManager->loadTypoScriptSetup();
-               return $typoScriptSetup['module.']['tx_' . strtolower($extensionName) . '.']['settings.'];
-       }
-
-}
-?>
\ No newline at end of file
index 89f3950..3f14a96 100644 (file)
@@ -103,7 +103,7 @@ class Tx_Extbase_Dispatcher {
                $this->initializeConfigurationManagerAndFrameworkConfiguration($configuration);
 
                $requestBuilder = t3lib_div::makeInstance('Tx_Extbase_MVC_Web_RequestBuilder');
-               $request = $requestBuilder->initialize($configuration);
+               $request = $requestBuilder->initialize(self::$extbaseFrameworkConfiguration);
                $request = $requestBuilder->build();
                $response = t3lib_div::makeInstance('Tx_Extbase_MVC_Web_Response');
 
@@ -156,22 +156,14 @@ class Tx_Extbase_Dispatcher {
         * @return void
         */
        protected function initializeConfigurationManagerAndFrameworkConfiguration($configuration) {
-               $configurationSources = array();
-               $configurationSources[] = t3lib_div::makeInstance('Tx_Extbase_Configuration_Source_TypoScriptSource');
+               self::$configurationManager = t3lib_div::makeInstance('Tx_Extbase_Configuration_FrontendConfigurationManager', $configurationSources);
+
                if (TYPO3_MODE === 'FE') {
-                       if (!empty($this->cObj->data['pi_flexform'])) {
-                               $configurationSource = t3lib_div::makeInstance('Tx_Extbase_Configuration_Source_FlexFormSource');
-                               $configurationSource->setFlexFormContent($this->cObj->data['pi_flexform']);
-                               $configurationSources[] = $configurationSource;
-                       }
-                       self::$configurationManager = t3lib_div::makeInstance('Tx_Extbase_Configuration_FrontendConfigurationManager', $configurationSources);
                        self::$configurationManager->setContentObject($this->cObj);
-               } else {
-                       self::$configurationManager = t3lib_div::makeInstance('Tx_Extbase_Configuration_BackendConfigurationManager', $configurationSources);
                }
                self::$extbaseFrameworkConfiguration = self::$configurationManager->getFrameworkConfiguration($configuration);
        }
-       
+
        /**
         * Initializes the cache framework
         *
@@ -219,7 +211,7 @@ class Tx_Extbase_Dispatcher {
                $propertyMapper = t3lib_div::makeInstance('Tx_Extbase_Property_Mapper');
                $propertyMapper->injectReflectionService(self::$reflectionService);
                $controller->injectPropertyMapper($propertyMapper);
-               $controller->injectSettings(self::$configurationManager->getSettings($request->getControllerExtensionName()));
+               $controller->injectSettings(self::$extbaseFrameworkConfiguration['settings']);
 
                $flashMessages = t3lib_div::makeInstance('Tx_Extbase_MVC_Controller_FlashMessages'); // singleton
                $flashMessages->reset();
index 98f0c0b..af72757 100755 (executable)
@@ -80,19 +80,19 @@ class Tx_Extbase_MVC_Web_RequestBuilder {
                }
                if (!empty($configuration['controller'])) {
                        $this->defaultControllerName = $configuration['controller'];
-               } elseif (is_array($configuration['switchableControllerActions.'])) {
-                       $firstControllerActions = current($configuration['switchableControllerActions.']);
+               } elseif (is_array($configuration['switchableControllerActions'])) {
+                       $firstControllerActions = current($configuration['switchableControllerActions']);
                        $this->defaultControllerName = $firstControllerActions['controller'];
                }
                if (!empty($configuration['action'])) {
                        $this->defaultActionName = $configuration['action'];
-               } elseif (is_array($configuration['switchableControllerActions.'])) {
-                       $firstControllerActions = current($configuration['switchableControllerActions.']);
+               } elseif (is_array($configuration['switchableControllerActions'])) {
+                       $firstControllerActions = current($configuration['switchableControllerActions']);
                        $this->defaultActionName = array_shift(t3lib_div::trimExplode(',', $firstControllerActions['actions'], TRUE));
                }
                $allowedControllerActions = array();
-               if (is_array($configuration['switchableControllerActions.'])) {
-                       foreach ($configuration['switchableControllerActions.'] as $controllerConfiguration) {
+               if (is_array($configuration['switchableControllerActions'])) {
+                       foreach ($configuration['switchableControllerActions'] as $controllerConfiguration) {
                                $controllerActions = t3lib_div::trimExplode(',', $controllerConfiguration['actions']);
                                foreach ($controllerActions as $actionName) {
                                        $allowedControllerActions[$controllerConfiguration['controller']][] = $actionName;
index 89f4059..b3952a7 100644 (file)
@@ -23,7 +23,7 @@
 ***************************************************************/
 
 /**
- * Utilities to manage plugins and  modules of an extension. Also useful to auto-generate the autoloader registry 
+ * Utilities to manage plugins and  modules of an extension. Also useful to auto-generate the autoloader registry
  * file ext_autoload.php.
  *
  * @package Extbase
@@ -143,6 +143,7 @@ tt_content.list.20.' . $pluginSignature . ' {
        $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
@@ -175,10 +176,10 @@ tt_content.list.20.' . $pluginSignature . ' {
 
                t3lib_extMgm::addPlugin(array($pluginTitle, $pluginSignature), 'list_type');
        }
-       
+
        /**
         * This method is called from t3lib_loadModules::checkMod and it replaces old conf.php.
-        * 
+        *
         * @param string $key The module name
         * @param string $fullpath      Absolute path to module
         * @param array $MCONF Reference to the array holding the configuration of the module
@@ -201,7 +202,7 @@ tt_content.list.20.' . $pluginSignature . ' {
                        list($extKey, $local) = explode('/', substr($config['icon'], 4), 2);
                        $config['icon'] = t3lib_extMgm::extRelPath($extKey) . $local;
                }
-         
+
                        // Initialize search for alternative icon:
                $altIconKey = 'MOD:' . $key . '/' . $config['icon'];            // Alternative icon key (might have an alternative set in $TBE_STYLES['skinImg']
                $altIconAbsPath = is_array($GLOBALS['TBE_STYLES']['skinImg'][$altIconKey]) ? t3lib_div::resolveBackPath(PATH_typo3.$GLOBALS['TBE_STYLES']['skinImg'][$altIconKey][0]) : '';
@@ -215,15 +216,15 @@ tt_content.list.20.' . $pluginSignature . ' {
                }
 
                        // Fill $MLANG
-               $MLANG['default']['ll_ref'] = $config['labels'];   
-               
+               $MLANG['default']['ll_ref'] = $config['labels'];
+
                        // Finally, set the icon with correct path:
                if (substr($tabImage, 0 ,3) === '../') {
                        $MLANG['default']['tabs_images']['tab'] = PATH_site . substr($tabImage, 3);
                } else {
                        $MLANG['default']['tabs_images']['tab'] = PATH_typo3 . $tabImage;
                }
-               
+
                        // If LOCAL_LANG references are used for labels of the module:
                if ($MLANG['default']['ll_ref']) {
                                // Now the 'default' key is loaded with the CURRENT language - not the english translation...
@@ -235,11 +236,11 @@ tt_content.list.20.' . $pluginSignature . ' {
                        $GLOBALS['LANG']->addModuleLabels($MLANG['default'], $key . '_');
                        $GLOBALS['LANG']->addModuleLabels($MLANG[$GLOBALS['LANG']->lang], $key . '_');
                }
-               
+
                        // Fill $modconf
                $modconf['script'] = 'mod.php?M=' . rawurlencode($key);
                $modconf['name'] = $key;
-                                       
+
                                // Default tab setting
                if ($MCONF['defaultMod']) {
                        $modconf['defaultMod'] = $MCONF['defaultMod'];
@@ -252,15 +253,15 @@ tt_content.list.20.' . $pluginSignature . ' {
                                $modconf['navFrameScript'] = $this->getRelativePath(PATH_typo3, $fullpath . '/' . $MCONF['navFrameScript']);
                        }
                }
-               
+
                        // Additional params for Navigation Frame Script: "&anyParam=value&moreParam=1"
                if ($MCONF['navFrameScriptParam']) {
                        $modconf['navFrameScriptParam'] = $MCONF['navFrameScriptParam'];
                }
-                               
+
                return $modconf;
        }
-       
+
        /**
         * Registers an Extbase module (main or sub) to the backend interface.
         * FOR USE IN ext_tables.php FILES
@@ -279,7 +280,7 @@ tt_content.list.20.' . $pluginSignature . ' {
                }
                $extensionKey = $extensionName; // FIXME This will break if the $extensionName is given as BlogExample
                $extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionName)));
-               
+
                $path = t3lib_extMgm::extPath($extensionKey, 'Classes/');
                $relPath = t3lib_extMgm::extRelPath($extensionKey) . 'Classes/';
 
@@ -295,14 +296,14 @@ tt_content.list.20.' . $pluginSignature . ' {
                } else {
                        $main = (strlen($main) > 0) ? $main : 'web'; // TODO By now, $main must default to 'web'
                }
-               
+
                if ((strlen($sub) > 0)) {
                        $sub = $extensionName . self::convertLowerUnderscoreToUpperCamelCase($sub);
                        $key = $main . '_' . $sub;
                } else {
                        $key = $main;
                }
-               
+
                $moduleConfig = array(
                        'name' => $key,
                        'extensionKey' => $extensionKey,
@@ -315,7 +316,7 @@ tt_content.list.20.' . $pluginSignature . ' {
 
                t3lib_extMgm::addModule($main, $sub, $position);
        }
-       
+
        // TODO PHPdoc
        public static function convertCamelCaseToLowerCaseUnderscored($string) {
                static $conversionMap = array();
@@ -334,7 +335,7 @@ tt_content.list.20.' . $pluginSignature . ' {
        public static function convertLowerUnderscoreToUpperCamelCase($camelCasedString) {
                return t3lib_div::underscoredToUpperCamelCase($camelCasedString);
        }
-       
+
                /**
         * Build the autoload registry for a given extension and place it ext_autoload.php.
         *
@@ -364,7 +365,7 @@ tt_content.list.20.' . $pluginSignature . ' {
                }
                $errors[] = 'Wrote the following data: <pre>' . htmlspecialchars($autoloadFileString) . '</pre>';
                return implode('<br />', $errors);
-       }       
+       }
 
        /**
         * Generate autoload PHP file data. Takes an associative array with class name to file mapping, and outputs it as PHP.
@@ -490,6 +491,6 @@ tt_content.list.20.' . $pluginSignature . ' {
                }
                return $returnValue;
        }
-       
+
 }
 ?>