-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Description
Hi,
I wanted to utilize the feature, which makes it possible to use sections as wrappers.
Here is my Layouts/Default.html
:
<f:render section="ContentWrap" contentAs="contentVariable">
<b>hello</b>
</f:render>
Templates/Main.html
<f:section name="ContentWrap">
<div class="my-class">
{contentVariable}
</div>
</f:section>
But {contentVariable}
is always null
.
After some debugging I found the troublemaker: \TYPO3Fluid\Fluid\View\AbstractTemplateView
and exactly this part:
if ($this->getCurrentRenderingType() === self::RENDERING_LAYOUT) {
// in case we render a layout right now, we will render a section inside a TEMPLATE.
$renderingTypeOnNextLevel = self::RENDERING_TEMPLATE;
} else {
$renderingContext = clone $renderingContext;
$renderingContext->setVariableProvider($renderingContext->getVariableProvider()->getScopeCopy($variables));
$renderingTypeOnNextLevel = $this->getCurrentRenderingType();
}
So, no variables are passed in case of rendering section inside of layout. If I simply add $renderingContext->setVariableProvider($renderingContext->getVariableProvider()->getScopeCopy($variables));
in if-section, everything works as expected.
The question: is it bug or made for purpose so?
Metadata
Metadata
Assignees
Labels
No labels