[TYPO3-mvc] How to get to typoscipt ?

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Jan 12 13:52:50 CET 2011


Hey,

> If you want to have access to your typoscript from everywhere in your code this snippet from my utility class could be what you're looking for:
>
>      /**
>      * get the typoscript settings
>      * @return mixed
>      */
>      static function getFrameworkConfig() {
>          // get extension config
>        return Tx_Extbase_Dispatcher::getExtbaseFrameworkConfiguration();
>      }
>
> You'll have to test it in the backend, as I'm only using it in the frontend.
> Let me know if it works.

Tx_Extbase_Dispatcher will be obsolete as of extbase 1.3.0. To get the 
correct configuration (f.e. in a service that can also be called from 
other extension) you can/should do it somehow like this in extbase 1.3.0 
and above:

/**
  * @var Tx_Extbase_Configuration_ConfigurationManagerInterface
  */
protected $configurationManager;

/**
  * Injects the Configuration Manager and is initializing the framework 
settings
  *
  * @param Tx_Extbase_Configuration_ConfigurationManagerInterface An 
instance of the Configuration Manager
  * @return void
  */
public function 
injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface 
$configurationManager) {
	$this->configurationManager = $configurationManager;
	$this->settings = 
$this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, 
'ExtKeyInUpperCamelCase', 'PluginKeyInUpperCamelCase');
}


If you leave the last two arguments empty (ExtKey and PluginKey) then 
the configuration from the currently used plugin will be loaded. This 
should also work in BE context.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list