From: Fabien Potencier Date: Fri, 1 Oct 2010 18:28:02 +0000 (+0200) Subject: added a note to get an extension reference X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=057a64c4258420d2ba21aa9436a5e5865a213e99;p=web%2Fkonrad%2Ftwig.git added a note to get an extension reference --- 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'])) + ; + } +}