1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

[feature/twig] Able to set chain of namespaces to search for loadTemplate()

This is done so that when event template files are included, if they
include files themselves, that namespace is checked first, then __main__
is checked to include the correct template file.

Also, when template files are included from a particular namespace, this is
done so that the files from that namespace are included first, then the
main namespace is checked.

We may want to change this behavior in the future to allow choosing which
locations have priority, but for now, this is what I am doing to make sure
the behavior is simple and always the same.

PHPBB3-11598
This commit is contained in:
Nathan Guse
2013-06-24 12:39:28 -05:00
parent 4881085f13
commit c958155fb6
4 changed files with 150 additions and 6 deletions

View File

@@ -21,6 +21,22 @@
*/
class phpbb_template_twig_tokenparser_include extends Twig_TokenParser_Include
{
/**
* Parses a token and returns a node.
*
* @param Twig_Token $token A Twig_Token instance
*
* @return Twig_NodeInterface A Twig_NodeInterface instance
*/
public function parse(Twig_Token $token)
{
$expr = $this->parser->getExpressionParser()->parseExpression();
list($variables, $only, $ignoreMissing) = $this->parseArguments();
return new phpbb_template_twig_node_include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
}
/**
* Gets the tag name associated with this token parser.
*