Permalink
Browse files

feature #4003 [Twig][Form] Moved twig.form.resources to a higher leve…

…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 2962e146fe30b97403eb5d1c0336881cc0962586
Showing with 25 additions and 32 deletions.
  1. +9 −19 cookbook/form/form_customization.rst
  2. +16 −13 reference/configuration/twig.rst
@@ -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',
),
// ...
@@ -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',
),
// ...
@@ -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:
@@ -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>
@@ -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',
@@ -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
-------------

0 comments on commit 2962e14

Please sign in to comment.