Project

General

Profile

Actions

Feature #77275

closed

Opposite of IfViewHelper

Added by Daniel Corn almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2016-07-28
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
easy
Sprint Focus:

Description

I think it would be good to have an inverse version of the IfViewHelper.

For me the following workaround is not very pretty:

    <f:if condition="{condition}">
        <f:then> </f:then>
        <f:else>This is the important part</f:else>
    </f:if>

My suggestion is to introduce the UnlessViewHelper, like in [Handlebars](http://handlebarsjs.com/builtin_helpers.html#unless)

    <f:unless condition="{hopeFullyFalse}">
        Alright, the variable is false
    </f:unless>

    <f:unless condition="{hopeFullyFalse}">
        <f:then>Alright, the variable is false</f:then>
        <f:else>Sorry the variable is true</f:else>
    </f:unless>

PS: Sorry if this is a duplicate

Actions

Also available in: Atom PDF