Created
November 14, 2014 13:55
-
-
Save dfritschy/f2df5e2c06c9ebfab5d9 to your computer and use it in GitHub Desktop.
TWIG macro to check wether a field is empty or not defined
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# check if a field is not defined or empty #} | |
{% macro is_empty(content, field_name) %}{% spaceless %} | |
{{ content.fields[field_name] is not defined or ez_is_field_empty(content, field_name) }} | |
{% endspaceless %}{% endmacro %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment