From 156d5c671fb9db28fbbdcacb974093c2c52b0f5b Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 10:13:16 -0500 Subject: [PATCH] [feature/twig] INCLUDEJS now uses the definition class This had to be done because, like DEFINE, setting variables to $context only affected the local file and any children, not parent templates. PHPBB3-11598 --- phpBB/includes/template/twig/definition.php | 19 +++++++++++++++++++ .../includes/template/twig/node/includejs.php | 4 ++-- .../prosilver/template/overall_footer.html | 2 +- .../subsilver2/template/overall_footer.html | 2 +- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/template/twig/definition.php b/phpBB/includes/template/twig/definition.php index 110437eb32..6557b209eb 100644 --- a/phpBB/includes/template/twig/definition.php +++ b/phpBB/includes/template/twig/definition.php @@ -47,4 +47,23 @@ class phpbb_template_twig_definition return $this; } + + /** + * Append to a variable + * + * @param string $name + * @param string $value + * @return phpbb_template_twig_definition + */ + public function append($name, $value) + { + if (!isset($this->definitions[$name])) + { + $this->definitions[$name] = ''; + } + + $this->definitions[$name] .= $value; + + return $this; + } } diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/includes/template/twig/node/includejs.php index f4c26affa4..bba5d4ef91 100644 --- a/phpBB/includes/template/twig/node/includejs.php +++ b/phpBB/includes/template/twig/node/includejs.php @@ -31,9 +31,9 @@ class phpbb_template_twig_node_includejs extends Twig_Node $config = $this->environment->get_phpbb_config(); $compiler - ->write("\$context['SCRIPTS'] .= '';\n\n") + ->raw(" . '?assets_version=" . $config['assets_version'] . "\">');\n") ; } } diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 5422cc7c10..dcb8058ee1 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -56,7 +56,7 @@ -{SCRIPTS} +{$SCRIPTS} diff --git a/phpBB/styles/subsilver2/template/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html index 3a29a0d752..2d794d9f71 100644 --- a/phpBB/styles/subsilver2/template/overall_footer.html +++ b/phpBB/styles/subsilver2/template/overall_footer.html @@ -14,7 +14,7 @@ -{SCRIPTS} +{$SCRIPTS}