aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/template
diff options
context:
space:
mode:
authorrechosen <rechosen@gmail.com>2013-08-08 11:31:06 +0200
committerrechosen <rechosen@gmail.com>2013-08-12 09:59:10 +0200
commit49824a0fd33df6b9da4e413ccd189379fb7f728b (patch)
treed6be08606e2f8a03e383e05f52253ec363109193 /phpBB/phpbb/template
parentc9cd7412f27014e98300a0b8bff15b03f70dee55 (diff)
downloadforums-49824a0fd33df6b9da4e413ccd189379fb7f728b.tar
forums-49824a0fd33df6b9da4e413ccd189379fb7f728b.tar.gz
forums-49824a0fd33df6b9da4e413ccd189379fb7f728b.tar.bz2
forums-49824a0fd33df6b9da4e413ccd189379fb7f728b.tar.xz
forums-49824a0fd33df6b9da4e413ccd189379fb7f728b.zip
[ticket/11777] Add subdirectory 'events/' to the template event search path
Makes the twig template engine look in the events/ subdirectory instead of the main styles/[style]/template/ directory for extension template events. Note that it does _not_ look recursively! PHPBB3-11777
Diffstat (limited to 'phpBB/phpbb/template')
-rw-r--r--phpBB/phpbb/template/twig/node/event.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php
index 971dea14fa..30a9963a77 100644
--- a/phpBB/phpbb/template/twig/node/event.php
+++ b/phpBB/phpbb/template/twig/node/event.php
@@ -18,6 +18,11 @@ if (!defined('IN_PHPBB'))
class phpbb_template_twig_node_event extends Twig_Node
{
+ /**
+ * The subdirectory in which all template event files must be placed
+ */
+ const TEMPLATE_EVENTS_SUBDIRECTORY = 'events/';
+
/** @var Twig_Environment */
protected $environment;
@@ -50,19 +55,19 @@ class phpbb_template_twig_node_event extends Twig_Node
// slower, but makes developing extensions easier (no need to
// purge the cache when a new event template file is added)
$compiler
- ->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n")
+ ->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/" . self::TEMPLATE_EVENTS_SUBDIRECTORY . "{$location}.html')) {\n")
->indent()
;
}
- if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html'))
+ if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . self::TEMPLATE_EVENTS_SUBDIRECTORY . $location . '.html'))
{
$compiler
->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n")
// We set the namespace lookup order to be this extension first, then the main path
->write("\$this->env->setNamespaceLookUpOrder(array('{$ext_namespace}', '__main__'));\n")
- ->write("\$this->env->loadTemplate('@{$ext_namespace}/{$location}.html')->display(\$context);\n")
+ ->write("\$this->env->loadTemplate('@{$ext_namespace}/" . self::TEMPLATE_EVENTS_SUBDIRECTORY . "{$location}.html')->display(\$context);\n")
->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n")
;
}