Fluid icon indicating copy to clipboard operation
Fluid copied to clipboard

Feature request: Fall through for f:switch ViewHelper

Open TheNaderio opened this issue 6 years ago • 3 comments

A fall through option for f:switch viewhelper would be a very nice to have.

Something like:

<f:switch expression="{expr}">

    <f:case value="val1"/>
    <f:case value="val2"/>
    <f:case value="val3">
        on one of this cases
    </f:case>

    <f:case value="val4">
        on val4
    </f:case>

    <f:defaultCase>
        default
    </f:case>

</f:switch>

Or maybe

<f:switch expression="{expr}">

    <f:case value="val1" fallthrough="val3"/>
    <f:case value="val2" fallthrough="val3"/>
    <f:case value="val3">
        on one of this cases
    </f:case>

    <f:case value="val4">
        on val4
    </f:case>

    <f:defaultCase>
        default
    </f:case>

</f:switch>

that would help in many cases where the same result should come out.

TheNaderio avatar Nov 07 '18 11:11 TheNaderio

Me too thanks

p410n3 avatar Apr 02 '19 09:04 p410n3

I can confirm that request too.

OrangeLeinad avatar May 18 '21 09:05 OrangeLeinad

How about:

<f:switch expression="{expr}">
    <f:case value="val3" additionalValues="{val1, val2}">
        on one of this cases
    </f:case>

    <f:case value="val4">
        on val4
    </f:case>

    <f:defaultCase>
        default
    </f:defaultCase>

</f:switch>

I'd also love to get an expression such as

<f:case value="val1 || val2 || val3">

to handle such cases.

bmack avatar May 18 '21 20:05 bmack