How to get current template name in a TWIG function

Big OMG

New Member
let's say I have created a custom twig function: templateName. \[code\]$twig = new Twig_Environment($loader);$twig->addFunction('templateName', new Twig_Function_Function('twig_template_name', array('needs_environment' => true)));\[/code\]Is there a way to get the name of the current template(s) in php. I imagine something like this:\[code\]function twig_template_name(Twig_Environment $env, $values = null) { return $env->getCurrentTemplateName();}\[/code\]Thanks in advance.
 
Top