unless ViewHelper <vhs:unless>
Unless
The opposite of f:
and only supporting negative matching.
Related to v:
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>
Copied!
Except without the f:
.
Example, tag mode
<v:unless condition="{somethingRequired}">
Warning! Something required was not present.
</v:unless>
Copied!
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?"
Copied!
Arguments
then
- DataType
- mixed
- Required
- false
- Description
- Value to be returned if the condition if met.
else
- DataType
- mixed
- Required
- false
- Description
- Value to be returned if the condition if not met.
condition
- DataType
- boolean
- Required
- true
- Description
- Condition which must be true, or then is rendered