Skip to content

Recursive calls not possible #99

@infabo

Description

@infabo

In classic Fluid with sections/partials you can do recursive calls.

Example:

<f:render section="Test" arguments="{foo: 1}"/>

<f:section name="Test">
    Hello World
    <f:if condition="{foo} === 1">
        <f:render section="Test" arguments="{foo: 0}"/>
    </f:if>
</f:section>

This would print:

Hello World Hello World

But you can't do alike with components.

Given you have a component called Button (c:atom.button) with an impossible condition:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
      xmlns:fc="http://typo3.org/ns/SMS/FluidComponents/ViewHelpers"
      data-namespace-typo3-fluid="true">
<fc:component>
    <fc:param name="link" type="Typolink"/>
    <fc:param name="label" type="string"/>
    <fc:param name="target" type="string" default="_self" optional="1"/>
    <fc:param name="style" type="string" default="primary" optional="1" description="<primary|secondary|alternate>"/>

    <fc:renderer>
       <f:link.typolink class="button button--{style}" parameter="{link}" title="{label}" target="{target}" additionalAttributes="{role: 'button'}">
           <span class="button__text">{label}</span>
       </f:link.typolink>
        <f:if condition="1 == 2">
            <c:atom.button link="{link}" label="foo"/>
        </f:if>
    </fc:renderer>
</fc:component>
</html>

Leads to:

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/vendor/typo3fluid/fluid/src/Core/Parser/TemplateParser.php on line 661

In runs into a endless recursion.

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