[FEATURE] Add option to search full typoscript to site config utility

This commit is contained in:
Philipp Dieter 2021-11-14 19:03:55 +01:00
parent 4a1ae9a7a2
commit 04041fa564

View File

@ -27,8 +27,10 @@ class SiteConfigUtility
* @var string $path * @var string $path
* @return string * @return string
*/ */
public static function getByPath($path) public static function getByPath(
{ $path,
$limitToSiteConfig = true
) {
$pathParts = explode('.', $path); $pathParts = explode('.', $path);
$objectManager = GeneralUtility::makeInstance( $objectManager = GeneralUtility::makeInstance(
ObjectManager::class ObjectManager::class
@ -40,7 +42,10 @@ class SiteConfigUtility
ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT
); );
$typoscript = GeneralUtility::removeDotsFromTS($typoscript); $typoscript = GeneralUtility::removeDotsFromTS($typoscript);
$siteConfig = $typoscript['config']['site']; $siteConfig = $typoscript;
if ($limitToSiteConfig) {
$siteConfig = $typoscript['config']['site'];
}
$current = &$siteConfig; $current = &$siteConfig;
foreach ($pathParts as $key) { foreach ($pathParts as $key) {
$current = &$current[$key]; $current = &$current[$key];