title: Twig embed and variable scope
body: <p>I'm running into some problems when nesting twig embeds, more particularly when both embeds have the same variable defined.</p>
  
  <p>An example: a simple code excerpt from a form layout with a fieldset, some rows and input elements (removed some variables for clarity):</p>
  
  <pre><code>{% embed 'components/frmGroup' with {'id':'myFieldset'} %}
      {% block main %}
          {% embed 'components/frmRow' with {'id':'mySpecialFormRow'} %}
              {% block main %}
                  {% include 'components/inpText' %}
                  ...
              {% endblock %}
          {% endembed %}
          {% embed 'components/frmRow' %}
              {% block main %}
                  {% include 'components/inpText' %}
                  ...
              {% endblock %}
          {% endembed %}
      {% endblock %}
  {% endembed %}
  </code></pre>
  
  <p>As you can see, both frmGroup (fieldset) and frmRow (row) components can take a variable <code>id</code>. The first frmRow embed is fine since it defines its own id, the problem arises with the second frmRow which doesn't need a specific id (and so doesn't define one). But when I look at the outputted html code, I see the formrow carries #myFieldset, the id set on the frmGroup embed. Not what I wanted to accomplish :)</p>
  
  <p>I've tried toying with the "only" keyword but that gave me some very weird results. I could use different variable names (frmGroupId and frmRowId) but that feels lame (and creates clutter), I could also explicitly define and empty id on the second frmRow, but then I have to remember what variables to define on what nested embeds, which isn't pretty either.</p>
  
  <p>So how do I solve this (and can it be solved in Twig)?</p>