Skip to content

Commit

Permalink
[BUGFIX] Respect templateName for fluid template assets rendering
Browse files Browse the repository at this point in the history
Rendering assets in fluid templates via the special
"HeaderAssets" and "FooterAssets" sections does now
properly work with a given "templateName" by rendering
the "view" before assets rendering takes place, as this
does internally correctly set the template name.

Resolves: #105390
Releases: main, 13.4
Change-Id: I7cb102a79c35a3e054d5d7d93027c5c9609aba20
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/86687
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Oliver Bartsch <bo@cedev.de>
stefanr authored and o-ba committed Nov 7, 2024
1 parent a682568 commit 58b7a8c
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Classes/ContentObject/FluidTemplateContentObject.php
Original file line number Diff line number Diff line change
@@ -135,9 +135,11 @@ public function render($conf = []): string
$variables = $this->contentDataProcessor->process($this->cObj, $conf, $variables);
$view->assignMultiple($variables);

// Rendering the view internally set's the template (paths). This is required for following asset rendering
$content = $view->render($templateFilename);

$this->renderFluidTemplateAssetsIntoPageRenderer($view, $variables);

$content = $view->render($templateFilename);
if (isset($conf['stdWrap.'])) {
return $this->cObj->stdWrap($content, $conf['stdWrap.']);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
page = PAGE
page.10 = FLUIDTEMPLATE
page.10 {
template = TEXT
template.value = <f:section name="HeaderAssets">Foo Header</f:section><f:section name="FooterAssets">Foo Footer</f:section>
templateName = AssetsSections
templateRootPaths {
10 = EXT:test_fluid_template/Resources/Private/Templates
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<f:section name="HeaderAssets">Foo Header</f:section><f:section name="FooterAssets">Foo Footer</f:section>

0 comments on commit 58b7a8c

Please sign in to comment.