Skip to content

Commit

Permalink
feature #4003 [Twig][Form] Moved twig.form.resources to a higher leve…
Browse files Browse the repository at this point in the history
…l (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
  • Loading branch information
weaverryan committed Sep 24, 2014
2 parents 8386d44 + 63d8657 commit 2962e14
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 32 deletions.
28 changes: 9 additions & 19 deletions cookbook/form/form_customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -455,29 +455,24 @@ form is rendered.
# app/config/config.yml
twig:
form:
resources:
- 'AcmeDemoBundle:Form:fields.html.twig'
form_themes:
- 'AcmeDemoBundle:Form:fields.html.twig'
# ...
.. code-block:: xml
<!-- app/config/config.xml -->
<twig:config>
<twig:form>
<resource>AcmeDemoBundle:Form:fields.html.twig</resource>
</twig:form>
<twig:form-theme>AcmeDemoBundle:Form:fields.html.twig</twig:form-theme>
<!-- ... -->
</twig:config>
.. code-block:: php
// app/config/config.php
$container->loadFromExtension('twig', array(
'form' => array(
'resources' => array(
'AcmeDemoBundle:Form:fields.html.twig',
),
'form_themes' => array(
'AcmeDemoBundle:Form:fields.html.twig',
),
// ...
Expand All @@ -493,28 +488,23 @@ resource to use such a layout:
# app/config/config.yml
twig:
form:
resources: ['form_table_layout.html.twig']
form_themes: ['form_table_layout.html.twig']
# ...
.. code-block:: xml
<!-- app/config/config.xml -->
<twig:config>
<twig:form>
<resource>form_table_layout.html.twig</resource>
</twig:form>
<twig:form-theme>form_table_layout.html.twig</twig:form-theme>
<!-- ... -->
</twig:config>
.. code-block:: php
// app/config/config.php
$container->loadFromExtension('twig', array(
'form' => array(
'resources' => array(
'form_table_layout.html.twig',
),
'form_themes' => array(
'form_table_layout.html.twig',
),
// ...
Expand Down
29 changes: 16 additions & 13 deletions reference/configuration/twig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ TwigBundle Configuration ("twig")
twig:
exception_controller: twig.controller.exception:showAction
form:
resources:
form_themes:
# Default:
- form_div_layout.html.twig
# Default:
- form_div_layout.html.twig
# Example:
- MyBundle::form.html.twig
# Example:
- MyBundle::form.html.twig
globals:
# Examples:
Expand Down Expand Up @@ -54,9 +53,8 @@ TwigBundle Configuration ("twig")
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/doctrine/twig-1.0.xsd">
<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">
<twig:form>
<twig:resource>MyBundle::form.html.twig</twig:resource>
</twig:form>
<twig:form-theme>form_div_layout.html.twig</twig:form-theme> <!-- Default -->
<twig:form-theme>MyBundle::form.html.twig</twig:form-theme>
<twig:global key="foo" id="bar" type="service" />
<twig:global key="pi">3.14</twig:global>
</twig:config>
Expand All @@ -65,10 +63,9 @@ TwigBundle Configuration ("twig")
.. code-block:: php
$container->loadFromExtension('twig', array(
'form' => array(
'resources' => array(
'MyBundle::form.html.twig',
)
'form_themes' => array(
'form_div_layout.html.twig', // Default
'MyBundle::form.html.twig',
),
'globals' => array(
'foo' => '@bar',
Expand All @@ -83,6 +80,12 @@ TwigBundle Configuration ("twig")
'strict_variables' => false,
));
.. caution::

The ``twig.form`` (``<twig:form />`` tag for xml) configuration key
has been deprecated and will be removed in 3.0. Instead, use the ``twig.form_themes``
option.

Configuration
-------------

Expand Down

0 comments on commit 2962e14

Please sign in to comment.