mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
Merge pull request #3591 from Nicofuma/ticket/12632
[ticket/12632] Add twig.debug and twig.auto_reload in config.yml
This commit is contained in:
@@ -34,6 +34,8 @@ class container_configuration implements ConfigurationInterface
|
||||
->arrayNode('twig')
|
||||
->addDefaultsIfNotSet()
|
||||
->children()
|
||||
->booleanNode('debug')->defaultValue(null)->end()
|
||||
->booleanNode('auto_reload')->defaultValue(null)->end()
|
||||
->booleanNode('enable_debug_extension')->defaultValue(false)->end()
|
||||
->end()
|
||||
->end()
|
||||
|
@@ -69,6 +69,20 @@ class core extends Extension
|
||||
}
|
||||
}
|
||||
|
||||
// Set the Twig options if defined in the environment
|
||||
$definition = $container->getDefinition('template.twig.environment');
|
||||
$twig_environment_options = $definition->getArgument(6);
|
||||
if ($config['twig']['debug'])
|
||||
{
|
||||
$twig_environment_options['debug'] = true;
|
||||
}
|
||||
if ($config['twig']['auto_reload'])
|
||||
{
|
||||
$twig_environment_options['auto_reload'] = true;
|
||||
}
|
||||
// Replace the 6th argument, the options passed to the environment
|
||||
$definition->replaceArgument(6, $twig_environment_options);
|
||||
|
||||
if ($config['twig']['enable_debug_extension'])
|
||||
{
|
||||
$definition = $container->getDefinition('template.twig.extensions.debug');
|
||||
|
@@ -65,7 +65,7 @@ class environment extends \Twig_Environment
|
||||
|
||||
$options = array_merge(array(
|
||||
'cache' => (defined('IN_INSTALL')) ? false : $cache_path,
|
||||
'debug' => defined('DEBUG'),
|
||||
'debug' => false,
|
||||
'auto_reload' => (bool) $this->phpbb_config['load_tplcompile'],
|
||||
'autoescape' => false,
|
||||
), $options);
|
||||
|
Reference in New Issue
Block a user