Skip to content

[Form] Allow to customize individual collection items in form themes #36039

@javiereguiluz

Description

@javiereguiluz

Description
For some app I need to customize each item inside a CollectionType form field. We have {% block collection_row %}, {% block collection_widget %}, etc. But we don't have a {% block collection_entry %} and {% block collection_entry_row %}, {% block collection_entry_widget %}, etc.

At the end I needed to do this. It works, but it looks fragile:

{% block form_row %}
    {# ... #}

    {% set is_collection_item = block_prefixes|last ends with '_entry' %}

    {% if is_collection_item %}
        <div class="property-collection-item">
            {{ form_widget(form) }}
        </div>
    {% else %}
        {{ form_widget(form) }}
    {% endif %}
{% endblock %}

So, should we add support for these collection_entry_* blocks?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions