Skip to content

Not possible to use wrapper-sections in Layout(s) #280

Description

@InvisibleKind

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions