Is it possible to get the name of the template that is calling a method in a twig extension?
Example:
private $templateInUse;
public function __construct(){
$templateInUse = $this->someMagicalFunction();
}
/**
* {@inheritdoc}
*/
public function getName() {
return 'twig_extension';
}
public function getTokenParsers()
{
return array(new TokenParser($this->templateInUse));
}
It would up eventually have an output of some:file:path.html.twig