Answers for "is defined twig template"

PHP
3

twig is set variable

{# defined works with variable names #}
{% if foo is defined %}
    ...
{% endif %}

{# and attributes on variables names #}
{% if foo.bar is defined %}
    ...
{% endif %}

{% if foo['bar'] is defined %}
    ...
{% endif %}
Posted by: Guest on February-11-2020
0

twig if

{% if online == false %}
    <p>Our website is in maintenance mode. Please, come back later.</p>
{% endif %}
Posted by: Guest on May-19-2020

Browse Popular Code Answers by Language