Documentation · ViewHelper reference

XSD schema file | vhs master

UnlessViewHelper

Unless

The opposite of f:if and only supporting negative matching. Related to v:or but allows more complex conditions.

Is the same as writing:

<f:if condition="{theThingToCheck}">
    <f:else>
        The thing that gets done
    </f:else>
</f:if>

Except without the f:else.

Example, tag mode

<v:unless condition="{somethingRequired}">
    Warning! Something required was not present.
</v:unless>

Example, inline mode illustrating v:or likeness

{defaultText -> v:unless(condition: originalText)}
    // which is much the same as...
{originalText -> v:or(alternative: defaultText}
    // ...but the "unless" counterpart supports anything as
    // condition instead of only checking "is content empty?"

/

  • Tag usage example

    <v:unless then="[mixed]" else="[mixed]" condition="1">
    	<!-- tag content - may be ignored! -->
    </v:unless>
  • Inline usage example

    {v:unless(then: [mixed], else: [mixed], condition: 1)}

Arguments

Argument Description Type
condition

Condition expression conforming to Fluid boolean rules

boolean
else

Value to be returned if the condition if not met.

mixed
then

Value to be returned if the condition if met.

mixed
Required attribute

Revision history