Utility functions
Empty
The empty(value) checks if the variable exists and if the value is not “falsy”. Returns true if var does not exist or has a value that is empty or equal to zero, aka falsely. Otherwise, it returns false.
{% empty({dataField}) ? 'No value' : 'Field has value' %}
What qualifies as "falsy"?
Anything that returns false if cast to boolean
Empty array
Zero as number
Zero as string
Empty string
null
false
undefined
JSON decode
Decode JSON string to use in an expression.
{% json_decode('{"key": "value"}', true) %}
Updated on: 17/12/2024
Thank you!