[TwigBundle] removed the extensions setting
This commit is contained in:
parent
afa30d9864
commit
96045739b1
@ -9,6 +9,9 @@ timeline closely anyway.
|
||||
beta4 to beta5
|
||||
--------------
|
||||
|
||||
* The `extensions` setting for Twig has been removed. There is now only one
|
||||
way to register Twig extensions, via the `twig.extension` tag.
|
||||
|
||||
* The stack of Monolog handlers now bubbles the records by default. To stop
|
||||
the propagation you need to configure the bubbling explicitly.
|
||||
|
||||
|
@ -32,7 +32,6 @@ class Configuration implements ConfigurationInterface
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$rootNode = $treeBuilder->root('twig');
|
||||
|
||||
$this->addExtensionsSection($rootNode);
|
||||
$this->addFormSection($rootNode);
|
||||
$this->addGlobalsSection($rootNode);
|
||||
$this->addTwigOptions($rootNode);
|
||||
@ -40,18 +39,6 @@ class Configuration implements ConfigurationInterface
|
||||
return $treeBuilder;
|
||||
}
|
||||
|
||||
private function addExtensionsSection(ArrayNodeDefinition $rootNode)
|
||||
{
|
||||
$rootNode
|
||||
->fixXmlConfig('extension')
|
||||
->children()
|
||||
->arrayNode('extensions')
|
||||
->prototype('scalar')->end()
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
}
|
||||
|
||||
private function addFormSection(ArrayNodeDefinition $rootNode)
|
||||
{
|
||||
$rootNode
|
||||
|
@ -55,12 +55,6 @@ class TwigExtension extends Extension
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($config['extensions'])) {
|
||||
foreach ($config['extensions'] as $id) {
|
||||
$container->getDefinition($id)->addTag('twig.extension');
|
||||
}
|
||||
}
|
||||
|
||||
unset(
|
||||
$config['form'],
|
||||
$config['globals'],
|
||||
|
@ -16,8 +16,6 @@
|
||||
<parameter key="twig.extension.routing.class">Symfony\Bridge\Twig\Extension\RoutingExtension</parameter>
|
||||
<parameter key="twig.extension.yaml.class">Symfony\Bridge\Twig\Extension\YamlExtension</parameter>
|
||||
<parameter key="twig.extension.form.class">Symfony\Bridge\Twig\Extension\FormExtension</parameter>
|
||||
<parameter key="twig.extension.text.class">Twig_Extensions_Extension_Text</parameter>
|
||||
<parameter key="twig.extension.debug.class">Twig_Extensions_Extension_Debug</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
@ -76,9 +74,5 @@
|
||||
<tag name="twig.extension" />
|
||||
<argument>%twig.form.resources%</argument>
|
||||
</service>
|
||||
|
||||
<service id="twig.extension.text" class="%twig.extension.text.class%" public="false" />
|
||||
|
||||
<service id="twig.extension.debug" class="%twig.extension.debug.class%" public="false" />
|
||||
</services>
|
||||
</container>
|
||||
|
@ -52,12 +52,6 @@ class TwigExtensionTest extends TestCase
|
||||
|
||||
$this->assertEquals('Twig_Environment', $container->getParameter('twig.class'), '->load() loads the twig.xml file');
|
||||
|
||||
// Extensions
|
||||
foreach (array('twig.extension.debug', 'twig.extension.text') as $id) {
|
||||
$config = $container->getDefinition($id);
|
||||
$this->assertEquals(array('twig.extension'), array_keys($config->getTags()), '->load() adds tags to extension definitions');
|
||||
}
|
||||
|
||||
// Form resources
|
||||
$resources = $container->getParameter('twig.form.resources');
|
||||
$this->assertContains('div_layout.html.twig', $resources, '->load() includes default template for form resources');
|
||||
|
@ -48,7 +48,7 @@ class FileType extends AbstractType
|
||||
public function getDefaultOptions(array $options)
|
||||
{
|
||||
return array(
|
||||
'type' => 'file',
|
||||
'type' => 'string',
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user