From 4522db76247b1a4f81a11869e06a7bfc0e64bc5e Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sat, 1 Nov 2014 12:31:58 +0100 Subject: [PATCH 1/2] [ticket/13266] Enable twig dump function PHPBB3-13266 --- phpBB/phpbb/template/twig/twig.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index a3b002f350..4d9ca44007 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -115,6 +115,11 @@ class twig extends \phpbb\template\base ) ); + if (defined('DEBUG')) + { + $this->twig->addExtension(new \Twig_Extension_Debug()); + } + $lexer = new \phpbb\template\twig\lexer($this->twig); $this->twig->setLexer($lexer); From 6850169095f099d8fd9f3886e60237134c77ddb4 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 22 Nov 2014 12:33:45 +0100 Subject: [PATCH 2/2] [ticket/13266] Enable the debug extension in the development environment PHPBB3-13266 --- phpBB/config/default/container/services_twig.yml | 3 +++ phpBB/config/development/config.yml | 3 +++ phpBB/phpbb/di/extension/container_configuration.php | 8 +++++++- phpBB/phpbb/di/extension/core.php | 6 ++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/phpBB/config/default/container/services_twig.yml b/phpBB/config/default/container/services_twig.yml index fc5f9ba6a1..25382a95a1 100644 --- a/phpBB/config/default/container/services_twig.yml +++ b/phpBB/config/default/container/services_twig.yml @@ -41,3 +41,6 @@ services: - @router tags: - { name: twig.extension } + + template.twig.extensions.debug: + class: Twig_Extension_Debug diff --git a/phpBB/config/development/config.yml b/phpBB/config/development/config.yml index 1c17b08931..f451eebe13 100644 --- a/phpBB/config/development/config.yml +++ b/phpBB/config/development/config.yml @@ -3,3 +3,6 @@ imports: core: require_dev_dependencies: true + + twig: + enable_debug_extension: true diff --git a/phpBB/phpbb/di/extension/container_configuration.php b/phpBB/phpbb/di/extension/container_configuration.php index 1f1c077472..ee58ec2b74 100644 --- a/phpBB/phpbb/di/extension/container_configuration.php +++ b/phpBB/phpbb/di/extension/container_configuration.php @@ -30,7 +30,13 @@ class container_configuration implements ConfigurationInterface $rootNode = $treeBuilder->root('core'); $rootNode ->children() - ->booleanNode('require_dev_dependencies')->defaultValue(false)->end() + ->booleanNode('require_dev_dependencies')->defaultValue(false)->end() + ->arrayNode('twig') + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('enable_debug_extension')->defaultValue(false)->end() + ->end() + ->end() ->end() ; return $treeBuilder; diff --git a/phpBB/phpbb/di/extension/core.php b/phpBB/phpbb/di/extension/core.php index 72d46fb05b..451efc8e35 100644 --- a/phpBB/phpbb/di/extension/core.php +++ b/phpBB/phpbb/di/extension/core.php @@ -67,6 +67,12 @@ class core extends Extension ); } } + + if ($config['twig']['enable_debug_extension']) + { + $definition = $container->getDefinition('template.twig.extensions.debug'); + $definition->addTag('twig.extension'); + } } /**