Skip to content

Commit 006ae65

Browse files
committed
Merge branch '2.2' into 2.3
2 parents 3c89c61 + e96e390 commit 006ae65

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

components/form/introduction.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ be from a normal form post or from an API.
1717
Installation
1818
------------
1919

20-
You can install the component in many different ways:
20+
You can install the component in 2 different ways:
2121

2222
* Use the official Git repository (https://github.com/symfony/Form);
23-
* Install it via Composer (``symfony/form`` on `Packagist`_).
23+
* :doc:`Install it via Composer </components/using_components>` (``symfony/form`` on `Packagist`_).
2424

2525
Configuration
2626
-------------
@@ -51,7 +51,8 @@ support for very important features:
5151
messages for submitted data.
5252

5353
The Symfony2 Form component relies on other libraries to solve these problems.
54-
Most of the time you will use Twig and the Symfony :doc:`HttpFoundation </components/http_foundation/introduction>`,
54+
Most of the time you will use Twig and the Symfony
55+
:doc:`HttpFoundation </components/http_foundation/introduction>`,
5556
Translation and Validator components, but you can replace any of these with
5657
a different library of your choice.
5758

@@ -66,8 +67,9 @@ Request Handling
6667
~~~~~~~~~~~~~~~~
6768

6869
To process form data, you'll need to grab information off of the request (typically
69-
``$_POST`` data) and pass the array of submitted data to :method:`Symfony\\Component\\Form\\Form::bind`.
70-
The Form component optionally integrates with Symfony's :doc:`HttpFoundation </components/http_foundation/introduction>`
70+
``$_POST`` data) and pass the array of submitted data to
71+
:method:`Symfony\\Component\\Form\\Form::bind`. The Form component optionally
72+
integrates with Symfony's :doc:`HttpFoundation </components/http_foundation/introduction>`
7173
component to make this even easier.
7274

7375
To integrate the HttpFoundation component, add the

cookbook/form/form_customization.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,24 @@ 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+
Child Forms
302+
...........
303+
304+
You can also apply a form theme to a specific child of your form:
305+
306+
.. code-block:: html+jinja
307+
308+
{% form_theme form.child 'AcmeDemoBundle:Form:fields.html.twig' %}
309+
310+
This is useful when you want to have a custom theme for a nested form that's
311+
different than the one of your main form. Just specify both your themes:
312+
313+
.. code-block:: html+jinja
314+
315+
{% form_theme form 'AcmeDemoBundle:Form:fields.html.twig' %}
316+
317+
{% form_theme form.child 'AcmeDemoBundle:Form:fields_child.html.twig' %}
318+
301319
.. _cookbook-form-php-theming:
302320

303321
Form Theming in PHP
@@ -333,6 +351,13 @@ When the ``form.age`` widget is rendered, Symfony will use the customized
333351
``integer_widget.html.php`` template and the ``input`` tag will be wrapped in
334352
the ``div`` element.
335353

354+
If you want to apply a theme to a specific child form, pass it to the ``setTheme``
355+
method:
356+
357+
.. code-block:: php
358+
359+
<?php $view['form']->setTheme($form['child'], 'AcmeDemoBundle:Form/Child'); ?>
360+
336361
.. _cookbook-form-twig-import-base-blocks:
337362

338363
Referencing Base Form Blocks (Twig specific)

0 commit comments

Comments
 (0)