Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get TYPO3 settings in the utility files?

plugin.tx_xxx {
    setting {
        storagePid = 23
    } 
}

I want this TYPO3 settings in utility file. Please help me.

like image 577
Vivek Parmar Avatar asked Jun 15 '15 07:06

Vivek Parmar


2 Answers

The above method works only in controller or services class try below it will work in any PHP files in Extension.

$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\Extbase\\Object\\ObjectManager');
$configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
$extbaseFrameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$storagePid = $extbaseFrameworkConfiguration['plugin.']['tx_guesthouse_guesthouse.']['settings.']['storagePid'];
like image 120
Bharat Parmar Avatar answered Oct 17 '22 21:10

Bharat Parmar


You can add below line in the your controller.

$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');    
$configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
$setting = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS);   
$ts_config = $setting['plugin.']['tx_xxxx.']['settings.']['storagePid'];

I think it will helpful to you. You can also used this typo3 settings in the services files as well.

like image 6
Vishal Tanna Avatar answered Oct 17 '22 21:10

Vishal Tanna