coreTypoScriptService->convertPlainArrayToTypoScriptArray($configuration); $contentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class); $contentObjectRenderer->setRequest($request); // @todo: Setting request to COR is probably important, but setting page record here *may* not be needed in this case? $contentObjectRenderer->start($request->getAttribute('frontend.page.information')->getPageRecord(), 'pages'); $configuration = $this->resolveTypoScriptConfiguration($configuration, $contentObjectRenderer); return $this->coreTypoScriptService->convertTypoScriptArrayToPlainArray($configuration); } /** * Parse a configuration with ContentObjectRenderer::cObjGetSingle() * if there is an array key without and with a dot at the end. * This sample would be identified as a TypoScript parsable configuration * part: * * [ * 'example' => 'TEXT' * 'example.' => [ * 'value' => 'some value' * ] * ] */ protected function resolveTypoScriptConfiguration(array $configuration, ContentObjectRenderer $contentObjectRenderer): array { foreach ($configuration as $key => $value) { $keyWithoutDot = rtrim((string)$key, '.'); if (isset($configuration[$keyWithoutDot]) && isset($configuration[$keyWithoutDot . '.'])) { $value = $contentObjectRenderer->cObjGetSingle( $configuration[$keyWithoutDot], $configuration[$keyWithoutDot . '.'], $keyWithoutDot ); $configuration[$keyWithoutDot] = $value; } elseif (!isset($configuration[$keyWithoutDot]) && isset($configuration[$keyWithoutDot . '.'])) { $configuration[$keyWithoutDot] = $this->resolveTypoScriptConfiguration($value, $contentObjectRenderer); } unset($configuration[$keyWithoutDot . '.']); } return $configuration; } }