8000 [FrameworkBundle] [TwigBundle] Move the hinclude key from templating … · symfony/symfony@98c6732 · GitHub
[go: up one dir, main page]

Skip to content

Commit 98c6732

Browse files
author
Amrouche Hamza
committed
[FrameworkBundle] [TwigBundle] Move the hinclude key from templating to fragments
1 parent f587944 commit 98c6732

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ private function addFragmentsSection(ArrayNodeDefinition $rootNode)
191191
->info('fragments configuration')
192192
->canBeEnabled()
193193
->children()
194+
->scalarNode('hinclude_default_template')->defaultNull()->end()
194195
->scalarNode('path')->defaultValue('/_fragment')->end()
195196
->end()
196197
->end()
< 8000 div class="d-flex flex-column">
@@ -603,6 +604,16 @@ private function addTemplatingSection(ArrayNodeDefinition $rootNode)
603604
$rootNode
604605
->children()
605606
->arrayNode('templating')
607+
->validate()
608+
->ifTrue(function ($v) {
609+
return null !== $v['hinclude_default_template'];
610+
})
611+
->then(function ($v) {
612+
@trigger_error('Using the key "hinclude_default_template" in the templating is deprecated since Symfony 4.3. Use the config key under fragments instead.', E_USER_DEPRECATED);
613+
614+
return $v;
615+
})
616+
->end()
606617
->info('templating configuration')
607618
->canBeEnabled()
608619
->beforeNormalization()
@@ -612,6 +623,7 @@ private function addTemplatingSection(ArrayNodeDefinition $rootNode)
612623
->children()
613624
->scalarNode('hinclude_default_template')->defaultNull()->end()
614625
->scalarNode('cache')->end()
626+
615627
->arrayNode('form')
616628
->addDefaultsIfNotSet()
617629
->fixXmlConfig('resource')

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ private function registerFragmentsConfiguration(array $config, ContainerBuilder
487487

488488
return;
489489
}
490+
$container->setParameter('fragment.renderer.hinclude.global_template', $config['hinclude_default_template']);
490491

491492
$loader->load('fragment_listener.xml');
492493
$container->setParameter('fragment.path', $config['path']);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ protected static function getBundleDefaultConfig()
209209
'fragments' => [
210210
'enabled' => false,
211211
'path' => '/_fragment',
212+
'hinclude_default_template' => null,
212213
],
213214
'profiler' => [
214215
'enabled' => false,

0 commit comments

Comments
 (0)
0