Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eae9ad0

Browse filesBrowse files
committed
feature #3875 Added a note about customizing a form with more than one template (javiereguiluz)
This PR was merged into the 2.3 branch. Discussion ---------- Added a note about customizing a form with more than one template | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | 2.3+ | Fixed tickets | #3643 Commits ------- ce14104 Fixed a minor grammar mistake 1b386ff Fixed a minor error 08d26ee Removed the old syntax and left just the "with" keyword syntax 94625c5 Fixed minor formatting issue 6621720 Minor formatting improvement 2b0213b Added a note about customizing a form with more than one template
2 parents a3fe74f + ce14104 commit eae9ad0
Copy full SHA for eae9ad0

File tree

Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed

‎cookbook/form/form_customization.rst

Copy file name to clipboardExpand all lines: cookbook/form/form_customization.rst
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,22 @@ When the ``form.age`` widget is rendered, Symfony will use the ``integer_widget`
298298
block from the new template and the ``input`` tag will be wrapped in the
299299
``div`` element specified in the customized block.
300300

301+
Multiple Templates
302+
..................
303+
304+
A form can also be customized by applying several templates. To do this, pass the
305+
name of all the templates as an array using the ``with`` keyword:
306+
307+
.. code-block:: html+jinja
308+
309+
{% form_theme form with ['::common.html.twig', ':Form:fields.html.twig',
310+
'AcmeDemoBundle:Form:fields.html.twig'] %}
311+
312+
{# ... #}
313+
314+
The templates can be located at different bundles and they can even be stored
315+
at the global ``app/Resources/views/`` directory.
316+
301317
Child Forms
302318
...........
303319

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.