1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[feature/twig] Append assets_version to includejs tag

Some fixes for main template parser

PHPBB3-11598
This commit is contained in:
Nathaniel Guse
2013-06-24 22:37:58 -05:00
parent 814d57d201
commit 3ca99f8122
5 changed files with 49 additions and 12 deletions

View File

@@ -9,8 +9,13 @@
class phpbb_template_twig_node_includejs extends Twig_Node
{
public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null)
/** @var Twig_Environment */
protected $environment;
public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $lineno, $tag = null)
{
$this->environment = $environment;
parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
}
@@ -23,10 +28,12 @@ class phpbb_template_twig_node_includejs extends Twig_Node
{
$compiler->addDebugInfo($this);
$config = $this->environment->get_phpbb_config();
$compiler
->write("\$context['SCRIPTS'] .= '<script type=\"text/javascript\" src=\"' . ")
->subcompile($this->getNode('expr'))
->raw(" . '\">';\n\n")
->raw(" . '?assets_version=" . $config['assets_version'] . "\"></script>';\n\n")
;
}
}