diff --git a/src/Symfony/Bundle/TwigBundle/CHANGELOG.md b/src/Symfony/Bundle/TwigBundle/CHANGELOG.md index 0da6ea205b..59f86af89b 100644 --- a/src/Symfony/Bundle/TwigBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/TwigBundle/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG 2.1.0 ----- + * added a new setting ("paths") to configure more paths for the Twig filesystem loader * added contextual escaping based on the template file name (disabled if you explicitly pass an autoescape option) * added a command that extracts translation messages from templates * added the real template name when an error occurs in a Twig template diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php index 8d58a02f33..7936d219b7 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php @@ -115,6 +115,7 @@ class Configuration implements ConfigurationInterface private function addTwigOptions(ArrayNodeDefinition $rootNode) { $rootNode + ->fixXmlConfig('path') ->children() ->scalarNode('autoescape')->end() ->scalarNode('base_template_class')->example('Twig_Template')->end() @@ -124,7 +125,7 @@ class Configuration implements ConfigurationInterface ->scalarNode('strict_variables')->end() ->scalarNode('auto_reload')->end() ->scalarNode('optimizations')->end() - ->arrayNode('loader_paths') + ->arrayNode('paths') ->prototype('variable')->end() ->end() ->end() diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php index 617beac993..d65dc9fb80 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php @@ -60,8 +60,8 @@ class TwigExtension extends Extension $reflClass = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension'); $container->getDefinition('twig.loader')->addMethodCall('addPath', array(dirname(dirname($reflClass->getFileName())).'/Resources/views/Form')); - if (!empty($config['loader_paths'])) { - foreach ($config['loader_paths'] as $path) { + if (!empty($config['paths'])) { + foreach ($config['paths'] as $path) { $container->getDefinition('twig.loader')->addMethodCall('addPath', array($path)); } } diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd b/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd index 810e24ffcb..2a72ef6fe4 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd @@ -11,6 +11,7 @@ + diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/full.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/full.php index 7733f17b9f..ba3150ea29 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/full.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/full.php @@ -18,4 +18,5 @@ $container->loadFromExtension('twig', array( 'charset' => 'ISO-8859-1', 'debug' => true, 'strict_variables' => true, + 'paths' => array('path1', 'path2'), )); diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/full.xml index dacc523d9f..63cbe3e6c1 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/full.xml +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/full.xml @@ -12,5 +12,7 @@ 3.14 + path1 + path2 diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/full.yml index baf7661997..8378e33159 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/full.yml +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/full.yml @@ -13,3 +13,4 @@ twig: charset: ISO-8859-1 debug: true strict_variables: true + paths: [path1, path2]