Is it posible to add custom global templates for items in collection form fields?
I don't want to customize the collection template itself, but the rendering of each object in the collection, for example for adding a specific class or markup to each object contained in the collection.
I have a form with a collection field added like this:
$builder
->add('items', 'collection', array(
'type' => new ItemType(),
'allow_add' => true,
'allow_delete' => true,
'prototype' => true
));
I want to define a twig template to add a "delete" button to each item in the collection (among other things).
I have found there is a 'collection_widget' template to customize collections, buy this is only for the collection itself, not individual items.
NOTE 1: I need to use a global template in order to do this for all collections in all forms, I know I can solve this for each form template, but that's not the point.
NOTE 2: So far I solved this with jquery, adding a class to collection_widget and adding buttons for all it's children with jquery. This works fine for now, but I'm looking for a 100% template solution, without having to do all the jquery handling. Ideally this should also work with the row prototype for adding new items.