title: How can I conditionally override a TWIG layout block?
body: <p>First, let me start with the code I'm attempting to use:</p>
  
  <pre><code>{% if modal == true %}
      {% block header %}{% endblock %}
      {% block footer %}{% endblock %}
  {% endif %}
  </code></pre>
  
  <p>What I'm trying to accomplish is to not show my header and footer blocks ONLY if the variable called modal is true. I also have this below the if statement:</p>
  
  <pre><code>{% block content %}
      {{ dump(modal) }}
  {% endblock %}
  </code></pre>
  
  <p>What happens here is that my override for emptying the header and footer blocks always runs regardless of if the value of modal is true or otherwise. So, I run this with modal passed in as false and the result is that the header and footer still don't show. The output of the dump command accurately shows true or false, but the condition always seems to evaluate to true in the if statement.</p>
  
  <p>Can blocks not be wrapped in a conditional statement, or is there something additional I need to do to make this work?</p>
  
  <p>Thanks for any help you can offer.</p>