Project

General

Profile

Actions

Feature #45877

closed

Adding an UnlessViewHelper convenience

Added by Pascal Dürsteler over 11 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Should have
Category:
Fluid
Target version:
-
Start date:
2013-02-27
Due date:
% Done:

0%

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

Description

AFAIK, you currently have to do something like this if you want to conditionally display something if it is not the case:

  <f:if condition="{...}">
    <f:then></f:then>
    <f:else>
      I just want this to be displayed and don't need the "if true case".
    </f:else>
  </f:if>

Peeking at ruby, I think some syntactic sugar could simplify this:

  <f:unless condition="{...}">
    <f:then>I like this</f:then>
  </f:unless>

This, of course, also accepts an else block. With this, however, you'll have the same amount of markup, but it may integrate better into your view logic.

  <f:unless condition="{...}">
    <f:then>not the case</f:then>
    <f:else>the case</f:else>
  </f:if>

If this does not encounter much resistance, I'd like to submit a patch.

Actions

Also available in: Atom PDF