From a910bf99f042f0ab4fe458def7ea046fee41366d Mon Sep 17 00:00:00 2001 From: Gilles Gauthier Date: Thu, 8 Jan 2015 14:15:03 +0100 Subject: [PATCH] customize collection field --- cookbook/form/form_customization.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index aa7622618b2..53096f502ff 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -734,6 +734,24 @@ You can also override the markup for an entire field row using the same method: widget($form) ?> +How to Customize a collection Field +----------------------------------- + +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 ---------------------------