Skip to content

Commit 946a937

Browse files
author
Stefano Sala
committed
[Twig][Form] Moved twig.form.resources to a higher level
1 parent 2ae4f34 commit 946a937

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed

cookbook/form/form_customization.rst

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -439,29 +439,24 @@ form is rendered.
439439
440440
# app/config/config.yml
441441
twig:
442-
form:
443-
resources:
444-
- 'AcmeDemoBundle:Form:fields.html.twig'
442+
form_themes:
443+
- 'AcmeDemoBundle:Form:fields.html.twig'
445444
# ...
446445
447446
.. code-block:: xml
448447
449448
<!-- app/config/config.xml -->
450449
<twig:config>
451-
<twig:form>
452-
<resource>AcmeDemoBundle:Form:fields.html.twig</resource>
453-
</twig:form>
450+
<twig:form-theme>AcmeDemoBundle:Form:fields.html.twig</twig:form-theme>
454451
<!-- ... -->
455452
</twig:config>
456453
457454
.. code-block:: php
458455
459456
// app/config/config.php
460457
$container->loadFromExtension('twig', array(
461-
'form' => array(
462-
'resources' => array(
463-
'AcmeDemoBundle:Form:fields.html.twig',
464-
),
458+
'form_themes' => array(
459+
'AcmeDemoBundle:Form:fields.html.twig',
465460
),
466461
467462
// ...
@@ -477,28 +472,23 @@ resource to use such a layout:
477472
478473
# app/config/config.yml
479474
twig:
480-
form:
481-
resources: ['form_table_layout.html.twig']
475+
form_themes: ['form_table_layout.html.twig']
482476
# ...
483477
484478
.. code-block:: xml
485479
486480
<!-- app/config/config.xml -->
487481
<twig:config>
488-
<twig:form>
489-
<resource>form_table_layout.html.twig</resource>
490-
</twig:form>
482+
<twig:form-theme>form_table_layout.html.twig</twig:form-theme>
491483
<!-- ... -->
492484
</twig:config>
493485
494486
.. code-block:: php
495487
496488
// app/config/config.php
497489
$container->loadFromExtension('twig', array(
498-
'form' => array(
499-
'resources' => array(
500-
'form_table_layout.html.twig',
501-
),
490+
'form_themes' => array(
491+
'form_table_layout.html.twig',
502492
),
503493
504494
// ...

reference/configuration/twig.rst

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ TwigBundle Configuration ("twig")
1010
1111
twig:
1212
exception_controller: twig.controller.exception:showAction
13-
form:
14-
resources:
13+
form_themes:
1514
16-
# Default:
17-
- form_div_layout.html.twig
15+
# Default:
16+
- form_div_layout.html.twig
1817
19-
# Example:
20-
- MyBundle::form.html.twig
18+
# Example:
19+
- MyBundle::form.html.twig
2120
globals:
2221
2322
# Examples:
@@ -54,9 +53,7 @@ TwigBundle Configuration ("twig")
5453
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/doctrine/twig-1.0.xsd">
5554
5655
<twig:config auto-reload="%kernel.debug%" autoescape="true" base-template-class="Twig_Template" cache="%kernel.cache_dir%/twig" charset="%kernel.charset%" debug="%kernel.debug%" strict-variables="false">
57-
<twig:form>
58-
<twig:resource>MyBundle::form.html.twig</twig:resource>
59-
</twig:form>
56+
<twig:form-theme>MyBundle::form.html.twig</twig:form-theme>
6057
<twig:global key="foo" id="bar" type="service" />
6158
<twig:global key="pi">3.14</twig:global>
6259
</twig:config>
@@ -65,10 +62,8 @@ TwigBundle Configuration ("twig")
6562
.. code-block:: php
6663
6764
$container->loadFromExtension('twig', array(
68-
'form' => array(
69-
'resources' => array(
70-
'MyBundle::form.html.twig',
71-
)
65+
'form_themes' => array(
66+
'MyBundle::form.html.twig',
7267
),
7368
'globals' => array(
7469
'foo' => '@bar',
@@ -83,6 +78,12 @@ TwigBundle Configuration ("twig")
8378
'strict_variables' => false,
8479
));
8580
81+
.. caution::
82+
83+
The ``twig.form`` (``<twig:form />`` tag for xml) configuration key
84+
has been deprecated and will be removed in 3.0.
85+
Instead, use the ``twig.form_themes`` option.
86+
8687
Configuration
8788
-------------
8889

0 commit comments

Comments
 (0)