title: Symfony: How to render a Collection Form Type in a custom format
body: <p>According to the <a href="https://symfony.com/doc/current/form/form_customization.html#how-to-customize-a-collection-prototype" rel="nofollow noreferrer">Symfony docs</a> an individual collection form type can be customized. How can I have Symfony to detect my customized twig template?
  It does not seem to work out of the box, but I might have missed something..</p>
  
  <p><strong>src\Form\Type\ItemAliasType:</strong></p>
  
  <pre><code>class ItemAliasType extends AbstractType
  {
      /**
       * {@inheritdoc}
       */
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder-&gt;add("name", TextType::class, [
              "label"              =&gt; "item alias name",
              "required"           =&gt; true,
          ]);
  
          $builder-&gt;add("description", TextType::class, [
              "label"              =&gt; "item alias name",
              "required"           =&gt; true,
          ]);
      }
  
      /**
       * {@inheritdoc}
       */
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults([
              'data_class' =&gt; ItemAlias::class,
          ]);
      }
  }
  </code></pre>
  
  <p><strong>src/Form/ItemForm:</strong></p>
  
  <pre><code>class ItemForm extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          /* ... code ... */
  
          $builder-&gt;add("aliases", CollectionType::class, array_merge([
              "label"              =&gt; "item-aliases",
              "entry_type"         =&gt; ItemAliasType::class,
              "allow_add"          =&gt; true,
              "allow_delete"       =&gt; true,
              "prototype"          =&gt; true,
          ], $inheritedOptions));
  
      }
  }
  </code></pre>
  
  <p><strong>templates/form/collections.html.twig:</strong></p>
  
  <pre><code>{% block _aliases_entry_row %}
      &lt;div class="custom"&gt;
          {{ form_widget(form.name) }}
          {{ form_widget(form.description) }}
      &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p><strong>config/packages/twig.yaml:</strong></p>
  
  <pre><code>twig:
      form_theme:
          - 'form/collections.html.twig'
  </code></pre>