title: How can i pass parameters to a Symfony2 Twig block?
body: <p>I want to generate table headers in a twig block and reuse them across the page, this page has about 5 different tables with roughly the same headers. The block code is such :</p>
  
  <pre><code>{% block table_headers %}
      &lt;th&gt;Fiscal Year&lt;/th&gt;
      &lt;th&gt;End Date&lt;/th&gt;
      &lt;th&gt;Period Length&lt;/th&gt;
      {% for item in result.FinancialStatements.COAMap.mapItem %}
          {% if item.statementType == statementType %}
              &lt;th&gt;{{ item._ }} ({{ item.coaItem }})&lt;/th&gt;
          {% endif %}
      {% endfor %} 
  {% endblock %}
  </code></pre>
  
  <p>The key line in the above code is </p>
  
  <pre><code>{% if item.statementType == statementType %}
  </code></pre>
  
  <p>I want to pass the statementType as parameter where i am rendering the block, like so :</p>
  
  <pre><code>{% render block.table_headers with {'statementType': 'INC'} %}
  </code></pre>
  
  <p>But this doesn't work. I want to keep the block and its rendering in the same file (but different blocks), for conceptual closeness.</p>
  
  <p>Is it even possible to use blocks like this? I've looked at the Symfony2 docs and couldn't find anything that suggested this could be done, but it seems such an obvious use of blocks to me.</p>