diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 15636fb1e616e..00d0053dc4cbd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -191,6 +191,7 @@ private function addFragmentsSection(ArrayNodeDefinition $rootNode) ->info('fragments configuration') ->canBeEnabled() ->children() + ->scalarNode('hinclude_default_template')->defaultNull()->end() ->scalarNode('path')->defaultValue('/_fragment')->end() ->end() ->end() @@ -610,7 +611,7 @@ private function addTemplatingSection(ArrayNodeDefinition $rootNode) ->then(function () { return ['enabled' => false, 'engines' => false]; }) ->end() ->children() - ->scalarNode('hinclude_default_template')->defaultNull()->end() + ->scalarNode('hinclude_default_template')->setDeprecated('Setting "templating.hinclude_default_template" is deprecated since Symfony 4.3, use "fragments.hinclude_default_template" instead.')->defaultNull()->end() ->scalarNode('cache')->end() ->arrayNode('form') ->addDefaultsIfNotSet() diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 92aca42e31229..338eddb949cbc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -487,6 +487,11 @@ private function registerFragmentsConfiguration(array $config, ContainerBuilder return; } + if ($container->hasParameter('fragment.renderer.hinclude.global_template') && null !== $container->getParameter('fragment.renderer.hinclude.global_template') && null !== $config['hinclude_default_template']) { + throw new \LogicException('You cannot set both "templating.hinclude_default_template" and "fragments.hinclude_default_template", please only use "fragments.hinclude_default_template".'); + } + + $container->setParameter('fragment.renderer.hinclude.global_template', $config['hinclude_default_template']); $loader->load('fragment_listener.xml'); $container->setParameter('fragment.path', $config['path']); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index 9d71b403ddb39..478a5059820a5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -69,6 +69,7 @@ + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index c2455606b9727..827988669fb8d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -209,6 +209,7 @@ protected static function getBundleDefaultConfig() 'fragments' => [ 'enabled' => false, 'path' => '/_fragment', + 'hinclude_default_template' => null, ], 'profiler' => [ 'enabled' => false, diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/template_and_fragments.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/template_and_fragments.php new file mode 100644 index 0000000000000..6fd941d9f46c0 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/template_and_fragments.php @@ -0,0 +1,18 @@ +loadFromExtension('framework', [ + 'templating' => [ + 'cache' => '/path/to/cache', + 'engines' => ['php', 'twig'], + 'loader' => ['loader.foo', 'loader.bar'], + 'form' => [ + 'resources' => ['theme1', 'theme2'], + ], + 'hinclude_default_template' => 'global_hinclude_template', + ], + 'assets' => null, + 'fragments' => [ + 'enabled' => true, + 'hinclude_default_template' => 'global_hinclude_template', + ], +]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/template_and_fragments.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/template_and_fragments.xml new file mode 100644 index 0000000000000..d253e9f5deeed --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/template_and_fragments.xml @@ -0,0 +1,24 @@ + + + + + + + + + + loader.foo + loader.bar + php + twig + + theme1 + theme2 + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/template_and_fragments.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/template_and_fragments.yml new file mode 100644 index 0000000000000..dbf7b697541e0 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/template_and_fragments.yml @@ -0,0 +1,12 @@ +framework: + fragments: + enabled: true + hinclude_default_template: global_hinclude_template + templating: + engines: [php, twig] + loader: [loader.foo, loader.bar] + cache: /path/to/cache + form: + resources: [theme1, theme2] + hinclude_default_template: global_hinclude_template + assets: ~ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index e3f727030ccc8..8ebe5d97513fb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -159,6 +159,14 @@ public function testEsiDisabled() $this->assertFalse($container->hasDefinition('esi')); } + /** + * @expectedException \LogicException + */ + public function testAmbiguousWhenBothTemplatingAndFragments() + { + $this->createContainerFromFile('template_and_fragments'); + } + public function testSsi() { $container = $this->createContainerFromFile('full'); 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