Feature #52640

Create an UnlessViewHelper as opposite to the IfViewHelper

Added by Marc Neuhaus almost 2 years ago. Updated about 1 year ago.

Status:Under Review Start date:2013-10-09
Priority:Should have Due date:
Assigned To:Marc Neuhaus % Done:

0%

Category:-
Target version:-
Has patch:No

Description

Sometimes the IfViewHelper syntax is quite verbose if you only want to do something on "else":

<f:if condition="...">
    <f:else>...</f:else>
</f:if>

As an alternative we discussed a new "UnlessViewHelper" in IRC to shorten this:

<f:unless condition="...">...</f:unless>

The only difference to the IfViewHelper is the negation of the condition.

This helps for example shortening the syntax for a ForLoop with condition for no objects from:

<f:if condition="{objects}">
    <f:then>
        <f:for each="{objects}" as="object">
            ...
        </f:for>
    </f:then>
    <f:else>No objects found</f:else>
</f:if>

to:

<f:for each="{objects}" as="object">
    ...
</f:for>
<f:unless condition="{objects}">No objects found</f:unless>

Related issues

related to TYPO3.Fluid - Feature #60430: Add a negate-option to the IfViewHelper Closed 2014-07-21
related to Core - Feature #45877: Adding an UnlessViewHelper convenience Closed 2013-02-27

History

#1 Updated by Gerrit Code Review almost 2 years ago

  • Status changed from New to Under Review

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/24504

#2 Updated by Gerrit Code Review almost 2 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/24504

#3 Updated by Gerrit Code Review almost 2 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/24504

#4 Updated by Gerrit Code Review almost 2 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/24504

#5 Updated by Anja Leichsenring almost 2 years ago

I am not sure this is an issue here, but there is no shorthand syntax possible with this kind of implementation. CMS Fluid will not accept such a shortcoming, we work on a different solution enabling shorthand syntax.

#6 Updated by Gerrit Code Review about 1 year ago

Patch set 4 for branch master of project Packages/TYPO3.Fluid has been pushed to the review server.
It is available at http://review.typo3.org/31707

Also available in: Atom PDF