Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions form/form_themes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,36 @@ names.
Fragment Naming for Collections
...............................

When using a :doc:`collection of forms </form/form_collections>`, the fragment
of each collection item follows a predefined pattern. For example, consider the
following complex example where a ``TaskManagerType`` has a collection of
``TaskListType`` which in turn has a collection of ``TaskType``::
When using a :doc:`collection of forms </form/form_collections>`, you have
several ways of customizing the collection and each of its entries. First,
use the following blocks to customize each part of all form collections:

.. code-block:: twig

{% block collection_row %} ... {% endblock %}
{% block collection_label %} ... {% endblock %}
{% block collection_widget %} ... {% endblock %}
{% block collection_help %} ... {% endblock %}
{% block collection_errors %} ... {% endblock %}

You can also customize each entry of all collections with the following blocks:

.. code-block:: twig

{% block collection_entry_row %} ... {% endblock %}
{% block collection_entry_label %} ... {% endblock %}
{% block collection_entry_widget %} ... {% endblock %}
{% block collection_entry_help %} ... {% endblock %}
{% block collection_entry_errors %} ... {% endblock %}

.. versionadded:: 5.1

The ``collection_entry_*`` blocks were introduced in Symfony 5.1.

Finally, you can customize specific form collections instead of all of them.
For example, consider the following complex example where a ``TaskManagerType``
has a collection of ``TaskListType`` which in turn has a collection of
``TaskType``::

class TaskManagerType extends AbstractType
{
Expand Down