10000 Merge pull request #352 from Bieleke/extending_twig_form_customization · adrienbrault/symfony-docs@3a35c70 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a35c70

Browse files
committed
Merge pull request symfony#352 from Bieleke/extending_twig_form_customization
Added information how to use the table layout for forms in twig.
2 parents 4021613 + b9cfdc4 commit 3a35c70

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cookbook/form/twig_form_customization.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,20 @@ template and then importing it inside your application configuration:
336336
Any customized form blocks inside the ``AcmeDemoBundle:Form:fields.html.twig``
337337
template will be used globally when form elements are rendered.
338338

339+
Standard twig uses the div layout for forms, however some people prefer the table layout.
340+
The technique to change to the table layout uses the same technique as it is listed above,
341+
however you will need to change:
342+
343+
``AcmeDemoBundle:Form:fields.html.twig`` to ``TwigBundle:Form:table_layout.html.twig``
344+
345+
Or if you only want to use it so now and then, you can put it in your twig template like this:
346+
347+
.. code-block:: html+jinja
348+
349+
{% form_theme form 'TwigBundle:Form:table_layout.html.twig' %}
350+
351+
Keep in mind the ``form`` in the above code is the variable that contains the ``FormView`` instance here.
352+
339353
How to customize an Individual field
340354
------------------------------------
341355

0 commit comments

Comments
 (0)
0