There is a way in the documentation in Symfony to customize an individual field based on the widget name / ID.
{% form_theme form _self %} {% block _product_name_widget %} <div class="text_widget"> {{ block('field_widget') }} </div> {% endblock %} {{ form_widget(form.name) }}
Here, the _product_name_widget fragment defines the template that will be used for the field whose id is product_name (and name is product [name]).
This works for a regular widget, but not for a widget inside a collection. Due to extra columns. Like this:
name="productbundle_product_type[foobar][1][value]" id="productbundle_product_type_foobar_1_value"
How can I tweak the twig setting inside the collection?
I thought something like this, but this does not work:
{% for db in edit_form.list %} {% block _productbundle_product_type_foobar_{{ db.name }}_widget %} <div class="text_widget"> {{ block('field_widget') }} </div> {% endblock %} {% endfor %}
Even the following does not work:
{% _productbundle_product_type_foobar_1_value_widget %}
What is the way to make it work?
user2382765
source share