title: Symfony and Twig: conditions in templates
body: <p>I have two bundles I created by my own: one to generate admin sections (<code>AdminBundle</code>), and another one to create bills (<code>BillingBundle</code>). <code>BillingBundle</code> has basically 2 entities: <code>Client</code> and <code>Bill</code> (1:m). </p>
  
  <p>If I install both bundles to generate the new/edit forms and lists for <code>Client</code> and <code>Bill</code> at the admin, I include a part at <code>config.yml</code> like this:</p>
  
  <pre><code>my_admin_bundle:
      entities: 
          project:  #whatever entity. Project at AppBundle for example
              new: true
              list: true
          client:
              new: true
              list: true
          bill:
              new: true
              list: true
  </code></pre>
  
  <p>On the other hand, on <code>AdminBundle</code> I have a template called <code>form.html.twig</code> which renders the form to create new elements. Basically it is just like this:</p>
  
  <pre><code>{{ form(form) }}
  </code></pre>
  
  <p>The doubt: since the form to create new <code>Bills</code> need a <code>.js</code> file (<code>accounting.js</code>), <em>how to include it only for new <code>Bill</code> form but not for new <code>Client</code> or <code>Project</code> forms ?</em></p>
  
  <p>As you can imagine, now I have this in <code>form.html.twig</code>:</p>
  
  <pre><code>{{ form(form) }}
  &lt;script src="/bundles/ziiwebbilling/js/accounting.js" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>but I <strong>don't</strong> need <code>accounting.js</code> at <code>form.html.twig</code> for new <code>Projects</code>, or new <code>Clients</code> forms.</p>
  
  <p><strong>NOTE</strong>: sorry if I extend too much with my explanation, but I don't know how to explain it in another way. Even the title of the question is awful, please edit it if you find something better.</p>
  
  <p><strong>EDIT</strong>: as I've just wrote at the first comment for jkucharovic's answer, what I'm really looking for to solve my problem, is a <strong>non-intrusive</strong> way, that is: I wouldn't like to add the line about <code>accounting.js</code> inside an <code>AdminBundle</code> template. Or maybe am I looking for "too much"?</p>