From 2c2b10097b6913d7df36bced4aa16f2dd08228d3 Mon Sep 17 00:00:00 2001 From: fabien Date: Fri, 8 Jan 2010 16:14:59 +0000 Subject: [PATCH] added a getName() method in the default Template abstract class git-svn-id: http://svn.twig-project.org/trunk@223 93ef8e89-cb99-4229-a87c-7fa0fa45744b --- lib/Twig/Node/Module.php | 11 +++++++++++ lib/Twig/Template.php | 2 ++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/lib/Twig/Node/Module.php b/lib/Twig/Node/Module.php index eec2d12..c7cb37a 100644 --- a/lib/Twig/Node/Module.php +++ b/lib/Twig/Node/Module.php @@ -202,6 +202,17 @@ class Twig_Node_Module extends Twig_Node implements Twig_NodeListInterface ; } + // original template name + $compiler + ->write("public function getName()\n", "{\n") + ->indent() + ->write('return ') + ->string($this->filename) + ->raw(";\n") + ->outdent() + ->write("}\n\n") + ; + $compiler ->outdent() ->write("}\n") diff --git a/lib/Twig/Template.php b/lib/Twig/Template.php index d37e7be..ee08910 100644 --- a/lib/Twig/Template.php +++ b/lib/Twig/Template.php @@ -34,4 +34,6 @@ abstract class Twig_Template extends Twig_Resource implements Twig_TemplateInter return ob_get_clean(); } + + abstract protected function getName(); } -- 1.7.2.5