From 2b0213b365f2f11e6c8db324f093280d5248512d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 26 May 2014 13:26:44 +0200 Subject: [PATCH 1/6] Added a note about customizing a form with more than one template --- cookbook/form/form_customization.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index 554816a1f67..df0f39075d5 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -298,6 +298,33 @@ When the ``form.age`` widget is rendered, Symfony will use the ``integer_widget` block from the new template and the ``input`` tag will be wrapped in the ``div`` element specified in the customized block. +Multiple templates +.................. + +A form can also be customized applying several templates. To do so, pass the +name of all the templates to the ``form_theme`` tag separating them with one +whitespace: + +.. code-block:: html+jinja + + {% form_theme form '::common.html.twig' ':Form:fields.html.twig' + 'AcmeDemoBundle:Form:fields.html.twig' %} + + {# ... #} + +The templates can be located at different bundles and they can even be stored +at the global ``app/Resources/views/`` directory. + +When using the ``with`` keyword, pass the templates as an array: + + +.. code-block:: html+jinja + + {% form_theme form with ['::common.html.twig', ':Form:fields.html.twig', + 'AcmeDemoBundle:Form:fields.html.twig'] %} + + {# ... #} + Child Forms ........... From 6621720cd5361a5ed22896799b457a6d95f48bc5 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 26 May 2014 13:29:30 +0200 Subject: [PATCH 2/6] Minor formatting improvement --- cookbook/form/form_customization.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index df0f39075d5..20dd97310d4 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -321,7 +321,7 @@ When using the ``with`` keyword, pass the templates as an array: .. code-block:: html+jinja {% form_theme form with ['::common.html.twig', ':Form:fields.html.twig', - 'AcmeDemoBundle:Form:fields.html.twig'] %} + 'AcmeDemoBundle:Form:fields.html.twig'] %} {# ... #} From 94625c5c4d44f2fb3e0629506fc72ca7c6917e03 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 26 May 2014 15:34:11 +0200 Subject: [PATCH 3/6] Fixed minor formatting issue --- cookbook/form/form_customization.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index 20dd97310d4..63b880dc0ca 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -298,7 +298,7 @@ When the ``form.age`` widget is rendered, Symfony will use the ``integer_widget` block from the new template and the ``input`` tag will be wrapped in the ``div`` element specified in the customized block. -Multiple templates +Multiple Templates .................. A form can also be customized applying several templates. To do so, pass the From 08d26ee18f856ccbf0f22846c418a24b5c0da804 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 10 Jun 2014 22:29:20 +0200 Subject: [PATCH 4/6] Removed the old syntax and left just the "with" keyword syntax --- cookbook/form/form_customization.rst | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index 63b880dc0ca..f43800e762e 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -302,29 +302,18 @@ Multiple Templates .................. A form can also be customized applying several templates. To do so, pass the -name of all the templates to the ``form_theme`` tag separating them with one -whitespace: +name of all the templates as an array using the ``with`` keyword: .. code-block:: html+jinja - {% form_theme form '::common.html.twig' ':Form:fields.html.twig' - 'AcmeDemoBundle:Form:fields.html.twig' %} + {% form_theme form with ['::common.html.twig', ':Form:fields.html.twig', + 'AcmeDemoBundle:Form:fields.html.twig'] %} {# ... #} The templates can be located at different bundles and they can even be stored at the global ``app/Resources/views/`` directory. -When using the ``with`` keyword, pass the templates as an array: - - -.. code-block:: html+jinja - - {% form_theme form with ['::common.html.twig', ':Form:fields.html.twig', - 'AcmeDemoBundle:Form:fields.html.twig'] %} - - {# ... #} - Child Forms ........... From 1b386fff89e4990e777747f660a48f559798a0b1 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 11 Jun 2014 08:46:53 +0200 Subject: [PATCH 5/6] Fixed a minor error --- cookbook/form/form_customization.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index f43800e762e..343edadfcdc 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -301,7 +301,7 @@ block from the new template and the ``input`` tag will be wrapped in the Multiple Templates .................. -A form can also be customized applying several templates. To do so, pass the +A form can also be customized applying several templates. To do this, pass the name of all the templates as an array using the ``with`` keyword: .. code-block:: html+jinja From ce1410461875f147b76b0fbca6457b69ffeb25eb Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 5 Jul 2014 15:33:52 +0200 Subject: [PATCH 6/6] Fixed a minor grammar mistake --- cookbook/form/form_customization.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index 343edadfcdc..3436715cc59 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -301,7 +301,7 @@ block from the new template and the ``input`` tag will be wrapped in the Multiple Templates .................. -A form can also be customized applying several templates. To do this, pass the +A form can also be customized by applying several templates. To do this, pass the name of all the templates as an array using the ``with`` keyword: .. code-block:: html+jinja