Last active
October 30, 2020 10:21
-
-
Save cepheiVV/b7497da4eaecbe453ab32fa6c05c1982 to your computer and use it in GitHub Desktop.
Load TypoScript Settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Vendor\ExtensionName\Utility; | |
use TYPO3\CMS\Core\Utility\GeneralUtility; | |
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; | |
use TYPO3\CMS\Extbase\Object\ObjectManager; | |
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; | |
use TYPO3\CMS\Core\TypoScript\TypoScriptService; | |
/** | |
* load typoscript of extension | |
*/ | |
class TypoScriptUtility | |
{ | |
/** | |
* @param string | |
* @param string | |
*/ | |
public static function loadSettings($baseObject='plugin', $plugin='tx_extname_pluginname') | |
{ | |
$objectManager = GeneralUtility::makeInstance(ObjectManager::class); | |
$configurationManager = $objectManager->get(ConfigurationManager::class); | |
$typoScriptService = $objectManager->get(TypoScriptService::class); | |
$ts = $configurationManager->getConfiguration( | |
ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT | |
); | |
$ts = $typoScriptService->convertTypoScriptArrayToPlainArray($ts); | |
return $ts[$baseObject][$plugin]['settings']; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment