Skip to content

Commit f44eef4

Browse files
committed
minor #13672 [FrameworkBundle] Enable assets by default (jakzal)
This PR was merged into the 2.7 branch. Discussion ---------- [FrameworkBundle] Enable assets by default | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #13667 | License | MIT | Doc PR | - This should make the tests pass again. There are two templates from TwigBundle that are used with functional tests, and require the asset() helper: * src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception_full.html.twig * src/Symfony/Bundle/TwigBundle/Resources/views/layout.html.twig Commits ------- f5c0a69 [FrameworkBundle] Enable assets by default.
2 parents 3bbca21 + f5c0a69 commit f44eef4

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,26 @@ public function getConfigTreeBuilder()
5353
return $v;
5454
})
5555
->end()
56+
->validate()
57+
->ifTrue(function ($v) { return !isset($v['assets']); })
58+
->then(function ($v) {
59+
if (!$v['templating']['assets_version']
60+
&& !count($v['templating']['assets_base_urls']['http'])
61+
&& !count($v['templating']['assets_base_urls']['ssl'])
62+
&& !count($v['templating']['packages'])
63+
) {
64+
$v['assets'] = array(
65+
'version' => null,
66+
'version_format' => '%%s?%%s',
67+
'base_path' => '',
68+
'base_urls' => array(),
69+
'packages' => array(),
70+
);
71+
}
72+
73+
return $v;
74+
})
75+
->end()
5676
->validate()
5777
->ifTrue(function ($v) { return isset($v['templating']); })
5878
->then(function ($v) {

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ protected static function getBundleDefaultConfig()
164164
'magic_call' => false,
165165
'throw_exception_on_invalid_index' => false,
166166
),
167+
'assets' => array(
168+
'version' => null,
169+
'version_format' => '%%s?%%s',
170+
'base_path' => '',
171+
'base_urls' => array(),
172+
'packages' => array(),
173+
),
167174
);
168175
}
169176
}

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=5.3.9",
20+
"symfony/asset": "~2.7|~3.0.0",
2021
"symfony/dependency-injection" : "~2.6,>=2.6.2",
2122
"symfony/config" : "~2.4",
2223
"symfony/event-dispatcher": "~2.5|~3.0.0",
@@ -48,7 +49,6 @@
4849
"symfony/yaml": "~2.0,>=2.0.5|~3.0.0"
4950
},
5051
"suggest": {
51-
"symfony/asset": "",
5252
"symfony/console": "For using the console commands",
5353
"symfony/finder": "For using the translation loader and cache warmer",
5454
"symfony/form": "For using forms",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy