Skip to content

Instantly share code, notes, and snippets.

@dfritschy
Created November 14, 2014 13:55
Show Gist options
  • Save dfritschy/f2df5e2c06c9ebfab5d9 to your computer and use it in GitHub Desktop.
Save dfritschy/f2df5e2c06c9ebfab5d9 to your computer and use it in GitHub Desktop.
TWIG macro to check wether a field is empty or not defined
{# 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