8000 [FrameworkBundle] Add the possibility to disable assets via xml · symfony/symfony@44588fa · GitHub
[go: up one dir, main page]

Skip to content
Sign in

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 44588fa

Browse files
committed
[FrameworkBundle] Add the possibility to disable assets via xml
1 parent 4910ac6 commit 44588fa

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
<xsd:element name="package" type="package" minOccurs="0" maxOccurs="unbounded" />
139139
</xsd:sequence>
140140

141+
<xsd:attribute name="enabled" type="xsd:boolean" />
141142
<xsd:attribute name="base-path" type="xsd:string" />
142143
<xsd:attribute name="version-strategy" type="xsd:string" />
143144
<xsd:attribute name="version" type="xsd:string" />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', array(
4+
'assets' => array(
5+
'enabled' => false,
6+
),
7+
));
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:framework="http://symfony.com/schema/dic/symfony"
6+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
7+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
8+
9+
<framework:config>
10+
<framework:assets enabled="false" />
11+
</framework:config>
12+
</container>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
framework:
2+
assets:
3+
enabled: false

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,13 @@ public function testAssetsDefaultVersionStrategyAsService()
423423
$this->assertEquals('assets.custom_version_strategy', (string) $defaultPackage->getArgument(1));
424424
}
425425

426+
public function testAssetsCanBeDisabled()
427+
{
428+
$container = $this->createContainerFromFile('assets_disabled');
429+
430+
$this->assertFalse($container->has('templating.helper.assets'), 'The templating.helper.assets helper service is removed when assets are disabled.');
431+
}
432+
426433
public function testWebLink()
427434
{
428435
$container = $this->createContainerFromFile('web_link');

0 commit comments

Comments
 (0)
0