From 057a64c4258420d2ba21aa9436a5e5865a213e99 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 1 Oct 2010 20:28:02 +0200 Subject: [PATCH] added a note to get an extension reference --- lib/Twig/Node/Expression/ExtensionReference.php | 38 +++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) create mode 100644 lib/Twig/Node/Expression/ExtensionReference.php diff --git a/lib/Twig/Node/Expression/ExtensionReference.php b/lib/Twig/Node/Expression/ExtensionReference.php new file mode 100644 index 0000000..bef9da7 --- /dev/null +++ b/lib/Twig/Node/Expression/ExtensionReference.php @@ -0,0 +1,38 @@ + + * @version SVN: $Id$ + */ +class Twig_Node_Expression_ExtensionReference extends Twig_Node_Expression +{ + public function __construct($name, $lineno, $tag = null) + { + parent::__construct(array(), array('name' => $name), $lineno, $tag); + } + + /** + * Compiles the node to PHP. + * + * @param Twig_Compiler A Twig_Compiler instance + */ + public function compile($compiler) + { + $compiler + ->addDebugInfo($this) + ->raw(sprintf("\$this->env->getExtension('%s')", $this['name'])) + ; + } +} -- 1.7.2.5