Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c3b00ce

Browse filesBrowse files
author
Stefano Sala
committed
[Twig][Form] Preserve the original twig.form.resources parameter name
1 parent 61b6162 commit c3b00ce
Copy full SHA for c3b00ce

File tree

Expand file treeCollapse file tree

5 files changed

+26
-39
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+26
-39
lines changed

‎src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private function addFormSection(ArrayNodeDefinition $rootNode)
5353
->ifTrue(function ($v) {
5454
return count($v['form']['resources']) > 0;
5555
})
56-
->then(function($v) {
56+
->then(function ($v) {
5757
$v['form_themes'] = array_unique(array_merge($v['form']['resources'], $v['form_themes']));
5858

5959
return $v;

‎src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,7 @@ public function load(array $configs, ContainerBuilder $container)
5555

5656
$container->setParameter('twig.exception_listener.controller', $config['exception_controller']);
5757

58-
// To prevent BC, load the configuration from both branches
59-
$formThemes = $config['form_themes'];
60-
61-
// @deprecated since 2.6, to be removed in 3.0
62-
$container->setParameter('twig.form.resources', $formThemes);
63-
$container->setParameter('twig.form_themes', $formThemes);
58+
$container->setParameter('twig.form.resources', $config['form_themes']);
6459

6560
$twigFilesystemLoaderDefinition = $container->getDefinition('twig.loader.filesystem');
6661

‎src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
</service>
109109

110110
<service id="twig.form.engine" class="%twig.form.engine.class%" public="false">
111-
<argument>%twig.form_themes%</argument>
111+
<argument>%twig.form.resources%</argument>
112112
</service>
113113

114114
<service id="twig.form.renderer" class="%twig.form.renderer.class%" public="false">

‎src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/full.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/full.php
+22-22Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@
66
'MyBundle::formDeprecated.html.twig',
77
)
88
),
9-
'form_themes' => array(
10-
'MyBundle::form.html.twig'
11-
),
12-
'globals' => array(
13-
'foo' => '@bar',
14-
'baz' => '@@qux',
15-
'pi' => 3.14,
16-
'bad' => array('key' => 'foo'),
17-
),
18-
'auto_reload' => true,
19-
'autoescape' => true,
20-
'base_template_class' => 'stdClass',
21-
'cache' => '/tmp',
22-
'charset' => 'ISO-8859-1',
23-
'debug' => true,
24-
'strict_variables' => true,
25-
'paths' => array(
26-
'path1',
27-
'path2',
28-
'namespaced_path1' => 'namespace',
29-
'namespaced_path2' => 'namespace',
30-
),
9+
'form_themes' => array(
10+
'MyBundle::form.html.twig'
11+
),
12+
'globals' => array(
13+
'foo' => '@bar',
14+
'baz' => '@@qux',
15+
'pi' => 3.14,
16+
'bad' => array('key' => 'foo'),
17+
),
18+
'auto_reload' => true,
19+
'autoescape' => true,
20+
'base_template_class' => 'stdClass',
21+
'cache' => '/tmp',
22+
'charset' => 'ISO-8859-1',
23+
'debug' => true,
24+
'strict_variables' => true,
25+
'paths' => array(
26+
'path1',
27+
'path2',
28+
'namespaced_path1' => 'namespace1',
29+
'namespaced_path2' => 'namespace2',
30+
),
3131
));

‎src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php
+1-9Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ public function testLoadEmptyConfiguration()
3535
// @deprecated since 2.6, to be removed in 3.0
3636
$this->assertContains('form_div_layout.html.twig', $container->getParameter('twig.form.resources'), '->load() includes default template for form resources');
3737

38-
$this->assertContains('form_div_layout.html.twig', $container->getParameter('twig.form_themes'), '->load() includes default template for form themes');
39-
4038
// Twig options
4139
$options = $container->getParameter('twig.options');
4240
$this->assertEquals(__DIR__.'/twig', $options['cache'], '->load() sets default value for cache option');
@@ -57,18 +55,12 @@ public function testLoadFullConfiguration($format)
5755
$this->assertEquals('Twig_Environment', $container->getParameter('twig.class'), '->load() loads the twig.xml file');
5856

5957
// Form resources
60-
// @deprecated since 2.6, to be removed in 3.0
6158
$resources = $container->getParameter('twig.form.resources');
6259
$this->assertContains('form_div_layout.html.twig', $resources, '->load() includes default template for form resources');
6360
$this->assertContains('MyBundle::form.html.twig', $resources, '->load() merges new templates into form resources');
61+
// @deprecated since 2.6, to be removed in 3.0
6462
$this->assertContains('MyBundle::formDeprecated.html.twig', $resources, '->load() merges new templates into form resources');
6563

66-
// Form themes
67-
$themes = $container->getParameter('twig.form_themes');
68-
$this->assertContains('form_div_layout.html.twig', $themes, '->load() includes default template for form themes');
69-
$this->assertContains('MyBundle::form.html.twig', $themes, '->load() merges new templates into form themes');
70-
$this->assertContains('MyBundle::formDeprecated.html.twig', $themes, '->load() merges new templates into form themes');
71-
7264
// Globals
7365
$calls = $container->getDefinition('twig')->getMethodCalls();
7466
$this->assertEquals('app', $calls[0][1][0], '->load() registers services as Twig globals');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.