twigphp/Twig — pull request #1572 by sergeylukin (2014-11-24 01:59:12+00:00)
Title: Add getLastLoadedTemplateName() method to Loaders

`getLastLoadedTemplateName()` simply returns name of template
that was loaded right before you called this method.

Quick example:

```
$twig->addFunction(new Twig_SimpleFunction('my_custom_function', function() use ($twig) {

$caller_template_name = $twig->getLoader()->getLastLoadedTemplateName();

echo "This function was called from {$caller_template_name}";

}));
```

`getLastLoadedTemplateName()` is very useful method in my case where
it allows me keeping track of where custom `translate()` Twig
function is used and making sure translators get a detailed info
about every term's contexts.