Siva
Siva

Reputation: 509

Get typoscript values in extbase framework

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 ??

Upvotes: 6

Views: 8478

Answers (2)

David
David

Reputation: 6084

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

Upvotes: 1

biesior
biesior

Reputation: 55798

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'];

Upvotes: 12

Related Questions