Skip to content

Commit f6fae3a

Browse files
committed
[Form] Document the new collection_entry_* blocks
1 parent 4cf2cdf commit f6fae3a

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

form/form_themes.rst

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,36 @@ names.
312312
Fragment Naming for Collections
313313
...............................
314314

315-
When using a :doc:`collection of forms </form/form_collections>`, the fragment
316-
of each collection item follows a predefined pattern. For example, consider the
317-
following complex example where a ``TaskManagerType`` has a collection of
318-
``TaskListType`` which in turn has a collection of ``TaskType``::
315+
When using a :doc:`collection of forms </form/form_collections>`, you have
316+
several ways of customizing the collection and each of its entries. First,
317+
use the following blocks to customize each part of all form collections:
318+
319+
.. code-block:: twig
320+
321+
{% block collection_row %} ... {% endblock %}
322+
{% block collection_label %} ... {% endblock %}
323+
{% block collection_widget %} ... {% endblock %}
324+
{% block collection_help %} ... {% endblock %}
325+
{% block collection_errors %} ... {% endblock %}
326+
327+
You can also customize each entry of all collections with the following blocks:
328+
329+
.. code-block:: twig
330+
331+
{% block collection_entry_row %} ... {% endblock %}
332+
{% block collection_entry_label %} ... {% endblock %}
333+
{% block collection_entry_widget %} ... {% endblock %}
334+
{% block collection_entry_help %} ... {% endblock %}
335+
{% block collection_entry_errors %} ... {% endblock %}
336+
337+
.. versionadded:: 5.1
338+
339+
The ``collection_entry_*`` blocks were introduced in Symfony 5.1.
340+
341+
Finally, you can customize specific form collections instead of all of them.
342+
For example, consider the following complex example where a ``TaskManagerType``
343+
has a collection of ``TaskListType`` which in turn has a collection of
344+
``TaskType``::
319345

320346
class TaskManagerType extends AbstractType
321347
{

0 commit comments

Comments
 (0)