Issue Bug Closed

#77161Fluid - IfViewHelper does not work correct in Loop/Partial

Peter Benke 07/20/16, 09:44 updated 07/21/16, 09:09

Description

Hi together,

IfViewHelper does not work correct in Loop/Partial:

ViewHelper:

/**
 * Check Rendering
 * @param string $testmode
 * @return string
 */
public function render($testmode) {

    if($testmode == 'then'){
        return $this->renderThenChild();
    }else{
        return $this->renderElseChild();
    }

}

Template:

<f:for each="{fluidtests}" as="fluidtest" iteration="iteration">

    <vh:childRendering testmode="then">
        <f:then>
            <span style="color:green">Inside Template: Then...</span><br>
        </f:then>
        <f:else>
            <span style="color:red">Inside Template: Else...</span><br>
        </f:else>
    </vh:childRendering>

    <f:render partial="Single" />

</f:for>

Partial:

<vh:childRendering testmode="then">
    <f:then>
        <span style="color:green">Inside Partial: Then...</span><br>
    </f:then>
    <f:else>
        <span style="color:red">Inside Partial: Else...</span><br>
    </f:else>
</vh:childRendering>
<hr>

Output:

Inside Template: Then...
Inside Partial: Then...

Inside Template: Then...
Inside Partial: Else...

Inside Template: Then...
Inside Partial: Else...

This is not correct (Inside Partial: Else…).
It should always be: “Inside Partial: Then…”

Seems, that there is a bug, if I have a partial inside a loop.

See attached Test-Extension.

Thank you.

Reviews 0

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