Issue Feature Closed

#77276Pass the content of a f:render tag to the child

Daniel Corn 07/28/16, 10:27 updated 07/28/16, 11:03

Description

I think it would be handy if the content of a f:render tag could be passed on to the child.

Example:

<!-- Parent section -->
<f:section name="main">
    <f:render section="child">
        <h1>This will be passed as a special variable to the child</h1>
        <p>More important text</p>
        <img />
    </f:render>

    <f:render section="child">
        <h1>Render the child with another content</h1>
        <p>More important text</p>
        <img />
    </f:render>
</f:section>

<!-- Inside the partial/section -->
<f:section name="child">
<div class="my-container">
    <!-- other complex markup -->

    {content} <!-- Insert the passed content here -->

    <!-- other complex markup -->
</div>
</f:section>

Use case:

I made a subclass of the RenderViewHelper which allowed me to pass a complex HTML content to the partial.

<!-- Parent section -->
<f:section name="main">
    <f:render partial="DateWrapper" section="main">
        <!-- Invoke the date rendering from calendarize -->
        <f:render partial="Event/Date" section="main" arguments="{index: index}"/>
    </f:render>

    <!-- more stuff -->

    <f:render partial="DateWrapper" section="main">
        <!-- Reuse the DateWrapper with other content  -->
        <f:format.date>{today}</f:format.date>
    </f:render>
</f:section>

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.