Symfony: trying to customize a collection form prototype
<p>I have this form:</p>

<pre><code>class BillType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
       $builder
        -&gt;add('user')
        -&gt;add('numberPlate')
        -&gt;add('servicesPerformed', CollectionType::class, array(
             'label' =&gt; false,
             'entry_type' =&gt; ServicePerformedType::class,
             'allow_add' =&gt; true,
        ))
        -&gt;add('Save', SubmitType::class)
    ;
    /**
     * @param OptionsResolver $resolver
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver-&gt;setDefaults(array(
            'data_class' =&gt; 'DefaultBundle\Entity\Bill'
        ));
    }
</code></pre>

<p>being <code>ServicePerformedType</code> class this:</p>

<pre><code>class ServicePerformedType extends AbstractType
{
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
     $builder
         -&gt;add('description', TextareaType::class, array('label' =&gt; false))
         -&gt;add('price', TextType::class, array('label' =&gt; false))
         -&gt;add('quantity', TextType::class, array('label' =&gt; false));
  }

}
</code></pre>

<p>And this template to render the form: </p>

<pre><code>{{ form(form) }}
&lt;a href="#"&gt;Add service&lt;/a&gt;

&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;

    var index = 0;
    $('a').on('click', function() {

        var prototype = $('#bill_servicesPerformed').data('prototype');

        prototype = prototype.replace(/_name_/g, index.toString());

        $('#bill_servicesPerformed').html(prototype);

        index++;
    })
&lt;/script&gt;
</code></pre>

<p>As it is said in the <a href="http://symfony.com/doc/current/cookbook/form/form_customization.html#how-to-customize-a-collection-prototype" rel="noreferrer">docs</a>, to get a custom prototype I should add the lines below at the top of my template:</p>

<pre><code>{% form_theme form _self %}

{% block _servicesPerformed_entry_widget %}
I WILL WRITE MY CUSTOM PROTOTYPE HERE
{% endblock %}
</code></pre>

<p>But when I press <code>Add service</code> I dont get the text <code>I WILL WRITE MY CUSTOME PROTOTYPE HERE</code>, but the <code>description</code>, <code>fields</code> and <code>quantity</code> related to the <code>ServicePerformedType</code> class as before..</p>

<p><strong>NOTE</strong>: maybe there are other ways to custom a form prototype, but I'm interested on this, so will be very thankful to someone who give a solution related to this way to custom form prototypes, thanks.</p>