8000 Changed it a bit and added explaination of the form variable that is … · chtitux/symfony-docs@b9cfdc4 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 8000 b9cfdc4

Browse files
committed
Changed it a bit and added explaination of the form variable that is used.
1 parent 014b37d commit b9cfdc4

File tree

1 file changed

+5
-31
lines changed

1 file changed

+5
-31
lines changed

cookbook/form/twig_form_customization.rst

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -336,45 +336,19 @@ 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-
Use table-layout for the forms instead of divs
340-
----------------------------------------------
341-
342339
Standard twig uses the div layout for forms, however some people prefer the table layout.
343-
Change you config.yml into this to make it system-wide:
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:
344342

345-
.. configuration-block::
343+
``AcmeDemoBundle:Form:fields.html.twig`` to ``TwigBundle:Form:table_layout.html.twig``
346344

347-
.. code-block:: yaml
348-
349-
# app/config/config.yml
350-
twig:
351-
form:
352-
resources: ['TwigBundle:Form:table_layout.html.twig']
353-
# ...
354-
355-
.. code-block:: xml
356-
357-
<!-- app/config/config.xml -->
358-
<twig:config ...>
359-
<twig:form>
360-
<twig:resource>TwigBundle:Form:table_layout.html.twig</twig:resource>
361-
</twig:form>
362-
<!-- ... -->
363-
</twig:config>
364-
365-
.. code-block:: php
366-
367-
// app/config/config.php
368-
$container->loadFromExtension('twig', array(
369-
'form' => array('resources' => array('TwigBundle:Form:table_layout.html.twig'))
370-
// ...
371-
));
372-
373345
Or if you only want to use it so now and then, you can put it in your twig template like this:
374346

375347
.. code-block:: html+jinja
376348

377349
{% 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.
378352

379353
How to customize an Individual field
380354
------------------------------------

0 commit comments

Comments
 (0)
0