Skip to content

Commit 2962e14

Browse files
committed
feature #4003 [Twig][Form] Moved twig.form.resources to a higher level (stefanosala)
This PR was merged into the master branch. Discussion ---------- [Twig][Form] Moved twig.form.resources to a higher level | Q | A | ------------- | --- | Doc fix? | no | New docs? | no, symfony/symfony#11343 | Applies to | >= 2.6 | Fixed tickets | - Commits ------- 63d8657 [Twig][Form] Moved twig.form.resources to a higher level
2 parents 8386d44 + 63d8657 commit 2962e14

File tree

2 files changed

+25
-32
lines changed

2 files changed

+25
-32
lines changed

cookbook/form/form_customization.rst

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -455,29 +455,24 @@ form is rendered.
455455
456456
# app/config/config.yml
457457
twig:
458-
form:
459-
resources:
460-
- 'AcmeDemoBundle:Form:fields.html.twig'
458+
form_themes:
459+
- 'AcmeDemoBundle:Form:fields.html.twig'
461460
# ...
462461
463462
.. code-block:: xml
464463
465464
<!-- app/config/config.xml -->
466465
<twig:config>
467-
<twig:form>
468-
<resource>AcmeDemoBundle:Form:fields.html.twig</resource>
469-
</twig:form>
466+
<twig:form-theme>AcmeDemoBundle:Form:fields.html.twig</twig:form-theme>
470467
<!-- ... -->
471468
</twig:config>
472469
473470
.. code-block:: php
474471
475472
// app/config/config.php
476473
$container->loadFromExtension('twig', array(
477-
'form' => array(
478-
'resources' => array(
479-
'AcmeDemoBundle:Form:fields.html.twig',
480-
),
474+
'form_themes' => array(
475+
'AcmeDemoBundle:Form:fields.html.twig',
481476
),
482477
483478
// ...
@@ -493,28 +488,23 @@ resource to use such a layout:
493488
494489
# app/config/config.yml
495490
twig:
496-
form:
497-
resources: ['form_table_layout.html.twig']
491+
form_themes: ['form_table_layout.html.twig']
498492
# ...
499493
500494
.. code-block:: xml
501495
502496
<!-- app/config/config.xml -->
503497
<twig:config>
504-
<twig:form>
505-
<resource>form_table_layout.html.twig</resource>
506-
</twig:form>
498+
<twig:form-theme>form_table_layout.html.twig</twig:form-theme>
507499
<!-- ... -->
508500
</twig:config>
509501
510502
.. code-block:: php
511503
512504
// app/config/config.php
513505
$container->loadFromExtension('twig', array(
514-
'form' => array(
515-
'resources' => array(
516-
'form_table_layout.html.twig',
517-
),
506+
'form_themes' => array(
507+
'form_table_layout.html.twig',
518508
),
519509
520510
// ...

reference/configuration/twig.rst

Lines changed: 16 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,8 @@ 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>form_div_layout.html.twig</twig:form-theme> <!-- Default -->
57+
<twig:form-theme>MyBundle::form.html.twig</twig:form-theme>
6058
<twig:global key="foo" id="bar" type="service" />
6159
<twig:global key="pi">3.14</twig:global>
6260
</twig:config>
@@ -65,10 +63,9 @@ TwigBundle Configuration ("twig")
6563
.. code-block:: php
6664
6765
$container->loadFromExtension('twig', array(
68-
'form' => array(
69-
'resources' => array(
70-
'MyBundle::form.html.twig',
71-
)
66+
'form_themes' => array(
67+
'form_div_layout.html.twig', // Default
68+
'MyBundle::form.html.twig',
7269
),
7370
'globals' => array(
7471
'foo' => '@bar',
@@ -83,6 +80,12 @@ TwigBundle Configuration ("twig")
8380
'strict_variables' => false,
8481
));
8582
83+
.. caution::
84+
85+
The ``twig.form`` (``<twig:form />`` tag for xml) configuration key
86+
has been deprecated and will be removed in 3.0. Instead, use the ``twig.form_themes``
87+
option.
88+
8689
Configuration
8790
-------------
8891

0 commit comments

Comments
 (0)