Skip to content

[Cookbook][Form] update form_customization.rst #4797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
18 changes: 18 additions & 0 deletions cookbook/form/form_customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,24 @@ You can also override the markup for an entire field row using the same method:
<?php echo $view['form']->widget($form) ?>
</div>

How to Customize a collection Field
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Collection" should be uppercased according to our style guide.

-----------------------------------

If you want to customize a collection field it's the same way as a simple field.
Imagine you have a collection of Image entities for your product. The difference is
that you don't have direct access a field like ``_product_images_0_widget``.
In this case you need to replace the index value by the keyword ``entry``:

.. code-block:: html+jinja

{% form_theme form _self %}

{% block _product_images_entry_widget %}
{{ form_widget(form) }}
{% endblock %}

{{ form_widget(form.product.images) }}

Other common Customizations
---------------------------

Expand Down