Get typoscript values in extbase framework
Asked Answered
B

2

6

I am new to extbase(MVC) Framework , How can we get typoscript values in our extension :

Eg : suppose if i have some typoscript values like:

plugin.tx_some-extname.somevlaueX = XXXX
plugin.tx_some-extname.somevlaueY = yyyy
plugin.tx_some-extname.somevlaueZ = zzzz

how will i get these values in a specific action of our controller .I hope this makes sense ??

Braca answered 7/1, 2013 at 5:31 Comment(2)
After searching a lot i guess, I got my answer Configuration_EXTBASE . I haven't tried this, Will update this after testing the same in my extbase extension . Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK:***SOME CONFIGURARION TYPE ***Braca
Redundant effort, check my answer for common solutionTindle
T
12

Declare values in the settings scope (in the setup field) ie:

plugin.tx_some-extname.settings {
    myXsetting = XXXX
}

So the all settings will be accesible in your plugin in $this->settings (as array) :

$valX = $this->settings['myXsetting'];
Tindle answered 7/1, 2013 at 5:46 Comment(2)
thanks for this quick help: i will try this and will post my outcome here .Braca
@bieser: This is working :) Once again thanks for the quick helpBraca
M
1

In TYPO3-7.6 + the whole TypoScript for an extension can be retrieved with

$typoScript = $this->configurationManager->getConfiguration( $this->configurationManager::CONFIGURATION_TYPE_FRAMEWORK);

where for the 1st parameter exist 3 different options:

$this->configurationManager::CONFIGURATION_TYPE_SETTINGS
$this->configurationManager::CONFIGURATION_TYPE_FRAMEWORK
$this->configurationManager::CONFIGURATION_TYPE_FULL_TYPOSCRIPT

optional for the function $this->configurationManager->getConfiguration() the extension-key can be given as 2nd parameter and the plugin-name as 3rd parameter. So the whole command looks like this:

$typoScript = $this->configurationManager->getConfiguration( $this->configurationManager::CONFIGURATION_TYPE_FRAMEWORK, $extensionKey,  $pluginName );

Consider that the static template has to be included in the backend-template to return the desired output.

ConfigurationManager is an instance of TYPO3\CMS\Extbase\Configuration\ConfigurationManager

Mraz answered 26/3, 2018 at 16:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.