diff options
author | rechosen <rechosen@gmail.com> | 2013-08-09 11:33:24 +0200 |
---|---|---|
committer | rechosen <rechosen@gmail.com> | 2013-08-12 09:59:11 +0200 |
commit | 7f76c9f9c7d9014f313f150a9596bec030f39915 (patch) | |
tree | 7c611c11ef5689340eecbf652683f8b623edc069 /phpBB/phpbb | |
parent | e1c9a875867953f6bfd4e442ae804c85377f8360 (diff) | |
download | forums-7f76c9f9c7d9014f313f150a9596bec030f39915.tar forums-7f76c9f9c7d9014f313f150a9596bec030f39915.tar.gz forums-7f76c9f9c7d9014f313f150a9596bec030f39915.tar.bz2 forums-7f76c9f9c7d9014f313f150a9596bec030f39915.tar.xz forums-7f76c9f9c7d9014f313f150a9596bec030f39915.zip |
[ticket/11777] Rename the extension template listener subdirectory to 'event/'
Per suggestion of EXreaction and nickvergessen, do not look for extension
template event listeners in styles/[style]/template/events/ but in
styles/[style]/template/event/ (without the trailing 's') to match the way
phpBB looks for php template event listeners.
PHPBB3-11777
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/template/twig/node/event.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 30a9963a77..c94e5fdf20 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -19,9 +19,10 @@ if (!defined('IN_PHPBB')) class phpbb_template_twig_node_event extends Twig_Node { /** - * The subdirectory in which all template event files must be placed + * The subdirectory in which all template listener files must be placed + * @var string */ - const TEMPLATE_EVENTS_SUBDIRECTORY = 'events/'; + protected $listener_directory = 'event/'; /** @var Twig_Environment */ protected $environment; @@ -42,7 +43,7 @@ class phpbb_template_twig_node_event extends Twig_Node { $compiler->addDebugInfo($this); - $location = $this->getNode('expr')->getAttribute('name'); + $location = $this->listener_directory . $this->getNode('expr')->getAttribute('name'); foreach ($this->environment->get_phpbb_extensions() as $ext_namespace => $ext_path) { @@ -55,19 +56,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}/" . self::TEMPLATE_EVENTS_SUBDIRECTORY . "{$location}.html')) {\n") + ->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n") ->indent() ; } - if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . self::TEMPLATE_EVENTS_SUBDIRECTORY . $location . '.html')) + if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $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}/" . self::TEMPLATE_EVENTS_SUBDIRECTORY . "{$location}.html')->display(\$context);\n") + ->write("\$this->env->loadTemplate('@{$ext_namespace}/{$location}.html')->display(\$context);\n") ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n") ; } |