aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/template/twig/node
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/template/twig/node')
-rw-r--r--phpBB/phpbb/template/twig/node/includeasset.php27
-rw-r--r--phpBB/phpbb/template/twig/node/includecss.php16
-rw-r--r--phpBB/phpbb/template/twig/node/includejs.php16
3 files changed, 11 insertions, 48 deletions
diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php
index 324823b8d7..3d3c6e4df8 100644
--- a/phpBB/phpbb/template/twig/node/includeasset.php
+++ b/phpBB/phpbb/template/twig/node/includeasset.php
@@ -49,33 +49,20 @@ abstract class includeasset extends \Twig_Node
->write("\$local_file = \$this->getEnvironment()->findTemplate(\$asset_path);\n")
->write("\$asset->set_path(\$local_file, true);\n")
->outdent()
- ->write("\$asset->add_assets_version('{$config['assets_version']}');\n")
- ->write("\$asset_file = \$asset->get_url();\n")
->write("}\n")
+ ->write("\$asset->add_assets_version('{$config['assets_version']}');\n")
->outdent()
->write("}\n")
- ->write("\$context['definition']->append('{$this->get_definition_name()}', '")
- ;
-
- $this->append_asset($compiler);
-
- $compiler
- ->raw("\n');\n")
+ ->write("\$context['definition']->set('STYLESHEETS', '__STYLESHEETS_PLACEHOLDER__');\n")
+ ->write("\$context['definition']->set('SCRIPTS', '__SCRIPTS_PLACEHOLDER__');\n")
+ ->write("\$this->getEnvironment()->get_assets_bag()->add_{$this->get_setters_name()}(\$asset);")
;
}
/**
- * Get the definition name
+ * Get the name of the assets bag setter
*
- * @return string (e.g. 'SCRIPTS')
- */
- abstract public function get_definition_name();
-
- /**
- * Append the output code for the asset
- *
- * @param \Twig_Compiler A Twig_Compiler instance
- * @return null
+ * @return string (e.g. 'script')
*/
- abstract protected function append_asset(\Twig_Compiler $compiler);
+ abstract public function get_setters_name();
}
diff --git a/phpBB/phpbb/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php
index 2dac154036..2e97d4972d 100644
--- a/phpBB/phpbb/template/twig/node/includecss.php
+++ b/phpBB/phpbb/template/twig/node/includecss.php
@@ -18,20 +18,8 @@ class includecss extends \phpbb\template\twig\node\includeasset
/**
* {@inheritdoc}
*/
- public function get_definition_name()
+ public function get_setters_name()
{
- return 'STYLESHEETS';
- }
-
- /**
- * {@inheritdoc}
- */
- public function append_asset(\Twig_Compiler $compiler)
- {
- $compiler
- ->raw("<link href=\"' . ")
- ->raw("\$asset_file . '\"")
- ->raw(' rel="stylesheet" type="text/css" media="screen" />')
- ;
+ return 'stylesheet';
}
}
diff --git a/phpBB/phpbb/template/twig/node/includejs.php b/phpBB/phpbb/template/twig/node/includejs.php
index e77f2afeed..505b49757b 100644
--- a/phpBB/phpbb/template/twig/node/includejs.php
+++ b/phpBB/phpbb/template/twig/node/includejs.php
@@ -18,20 +18,8 @@ class includejs extends \phpbb\template\twig\node\includeasset
/**
* {@inheritdoc}
*/
- public function get_definition_name()
+ public function get_setters_name()
{
- return 'SCRIPTS';
- }
-
- /**
- * {@inheritdoc}
- */
- protected function append_asset(\Twig_Compiler $compiler)
- {
- $compiler
- ->raw("<script type=\"text/javascript\" src=\"' . ")
- ->raw("\$asset_file")
- ->raw(". '\"></script>\n")
- ;
+ return 'script';
}
}