Skip to content

Commit 25fd665

Browse files
Nyholmfabpot
authored andcommitted
[FrameworkBundle] Make sure one can use fragments.hinclude_default_template
1 parent 7e1a7b7 commit 25fd665

File tree

5 files changed

+31
-1
lines changed

5 files changed

+31
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ private function registerFragmentsConfiguration(array $config, ContainerBuilder
523523

524524
return;
525525
}
526-
if ($container->hasParameter('fragment.renderer.hinclude.global_template') && null !== $container->getParameter('fragment.renderer.hinclude.global_template') && null !== $config['hinclude_default_template']) {
526+
if ($container->hasParameter('fragment.renderer.hinclude.global_template') && '' !== $container->getParameter('fragment.renderer.hinclude.global_template') && null !== $config['hinclude_default_template']) {
527527
throw new \LogicException('You cannot set both "templating.hinclude_default_template" and "fragments.hinclude_default_template", please only use "fragments.hinclude_default_template".');
528528
}
529529

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'fragments' => [
5+
'enabled' => true,
6+
'hinclude_default_template' => 'global_hinclude_template',
7+
],
8+
]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:fragments enabled="true" hinclude-default-template="global_hinclude_template"/>
10+
</framework:config>
11+
</container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
framework:
2+
fragments:
3+
enabled: true
4+
hinclude_default_template: global_hinclude_template

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

+7
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ public function testAmbiguousWhenBothTemplatingAndFragments()
170170
$this->createContainerFromFile('template_and_fragments');
171171
}
172172

173+
public function testFragmentsAndHinclude()
174+
{
175+
$container = $this->createContainerFromFile('fragments_and_hinclude');
176+
$this->assertTrue($container->hasParameter('fragment.renderer.hinclude.global_template'));
177+
$this->assertEquals('global_hinclude_template', $container->getParameter('fragment.renderer.hinclude.global_template'));
178+
}
179+
173180
public function testSsi()
174181
{
175182
$container = $this->createContainerFromFile('full');

0 commit comments

Comments
 (0)