[FrameworkBundle] templating can be fully disabled
This commit is contained in:
parent
04f265911e
commit
92a7f10de5
@ -320,6 +320,10 @@ class Configuration implements ConfigurationInterface
|
||||
->arrayNode('templating')
|
||||
->info('templating configuration')
|
||||
->canBeEnabled()
|
||||
->beforeNormalization()
|
||||
->ifTrue(function ($v) { return false === $v || is_array($v) && false === $v['enabled']; })
|
||||
->then(function () { return array('enabled' => false, 'engines' => false); })
|
||||
->end()
|
||||
->children()
|
||||
->scalarNode('hinclude_default_template')->defaultNull()->end()
|
||||
->scalarNode('cache')->end()
|
||||
@ -346,8 +350,9 @@ class Configuration implements ConfigurationInterface
|
||||
->example(array('twig'))
|
||||
->isRequired()
|
||||
->requiresAtLeastOneElement()
|
||||
->canBeUnset()
|
||||
->beforeNormalization()
|
||||
->ifTrue(function ($v) { return !is_array($v); })
|
||||
->ifTrue(function ($v) { return !is_array($v) && false !== $v; })
|
||||
->then(function ($v) { return array($v); })
|
||||
->end()
|
||||
->prototype('scalar')->end()
|
||||
|
@ -147,10 +147,11 @@
|
||||
<xsd:complexType name="templating">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="loader" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="engine" type="xsd:string" minOccurs="1" maxOccurs="unbounded" />
|
||||
<xsd:element name="engine" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="form" type="form-resources" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:sequence>
|
||||
|
||||
<xsd:attribute name="enabled" type="xsd:boolean" />
|
||||
<xsd:attribute name="cache" type="xsd:string" />
|
||||
<xsd:attribute name="hinclude-default-template" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
$container->loadFromExtension('framework', array(
|
||||
'templating' => false,
|
||||
));
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:framework="http://symfony.com/schema/dic/symfony"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
||||
|
||||
<framework:config>
|
||||
<framework:templating enabled="false" />
|
||||
</framework:config>
|
||||
</container>
|
@ -0,0 +1,2 @@
|
||||
framework:
|
||||
templating: false
|
@ -208,6 +208,13 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$this->assertEquals('global_hinclude_template', $container->getParameter('fragment.renderer.hinclude.global_template'), '->registerTemplatingConfiguration() registers the global hinclude.js template');
|
||||
}
|
||||
|
||||
public function testTemplatingCanBeDisabled()
|
||||
{
|
||||
$container = $this->createContainerFromFile('templating_disabled');
|
||||
|
||||
$this->assertFalse($container->hasParameter('templating.engines'), '"templating.engines" container parameter is not registered when templating is disabled.');
|
||||
}
|
||||
|
||||
public function testAssets()
|
||||
{
|
||||
$container = $this->createContainerFromFile('assets');
|
||||
|
Reference in New Issue
Block a user