Feature #52640

Create an UnlessViewHelper as opposite to the IfViewHelper

Added by Marc Neuhaus over 6 years ago. Updated over 5 years ago.

Status:
Under Review
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2013-10-09
Due date:
% Done:

0%

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 Core - Feature #45877: Adding an UnlessViewHelper convenience Closed 2013-02-27
Related to TYPO3.Fluid - Feature #60430: Add a negate-option to the IfViewHelper Closed 2014-07-21

History

#1 Updated by Gerrit Code Review over 6 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 over 6 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 over 6 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 over 6 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 about 6 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 over 5 years 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