diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index b5a37b1ece655d2577ceeaafba27b09362af18ef..8f4280050d41d178281a52e4bf8808df7877aaa6 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -598,20 +598,31 @@ class ContentObjectRenderer implements LoggerAwareInterface * @see cObjGetSingle() */ public function cObjGet($setup, $addKey = '') + { + return implode('', $this->cObjGetSeparated($setup, $addKey)); + } + + /** + * Rendering of a "numerical array" of cObjects from TypoScript + * Will call ->cObjGetSingle() for each cObject found. + * + * @return list<string> + */ + public function cObjGetSeparated(?array $setup, string $addKey = ''): array { if (!is_array($setup) || $setup === []) { - return ''; + return []; } $sKeyArray = ArrayUtility::filterAndSortByNumericKeys($setup); - $content = ''; + $contentObjects = []; foreach ($sKeyArray as $theKey) { $theValue = $setup[$theKey]; if ((int)$theKey && !str_contains($theKey, '.')) { $conf = $setup[$theKey . '.'] ?? []; - $content .= $this->cObjGetSingle($theValue, $conf, $addKey . $theKey); + $contentObjects[] = $this->cObjGetSingle($theValue, $conf, $addKey . $theKey); } } - return $content; + return $contentObjects; } /** diff --git a/typo3/sysext/frontend/Classes/Http/RequestHandler.php b/typo3/sysext/frontend/Classes/Http/RequestHandler.php index af43302f292a696bf762a3b32d89f38432fa539c..49309453dba56b38ff60e5edb97e115b858936d3 100644 --- a/typo3/sysext/frontend/Classes/Http/RequestHandler.php +++ b/typo3/sysext/frontend/Classes/Http/RequestHandler.php @@ -696,9 +696,21 @@ class RequestHandler implements RequestHandlerInterface ); // Javascript inline code - $inlineJS = (string)$controller->cObj->cObjGet($controller->pSetup['jsInline.'] ?? null, 'jsInline.'); + $inlineJS = implode( + LF, + $controller->cObj->cObjGetSeparated( + $controller->pSetup['jsInline.'] ?? null, + 'jsInline.' + ) + ); // Javascript inline code for Footer - $inlineFooterJs = (string)$controller->cObj->cObjGet($controller->pSetup['jsFooterInline.'] ?? null, 'jsFooterInline.'); + $inlineFooterJs = implode( + LF, + $controller->cObj->cObjGetSeparated( + $controller->pSetup['jsFooterInline.'] ?? null, + 'jsFooterInline.' + ) + ); $compressJs = (bool)($controller->config['config']['compressJs'] ?? false); // Needs to be called after call cObjGet() calls in order to get all headerData and footerData and replacements