Skip to content

Instantly share code, notes, and snippets.

@cepheiVV
Last active October 30, 2020 10:21
Show Gist options
  • Save cepheiVV/b7497da4eaecbe453ab32fa6c05c1982 to your computer and use it in GitHub Desktop.
Save cepheiVV/b7497da4eaecbe453ab32fa6c05c1982 to your computer and use it in GitHub Desktop.
Load TypoScript Settings
<?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