Hello,

I have written a custom dynamic filter ; its goal being internationalization of templates. Now I need that filter to find out about its calling template (I don't ask for the line number in the template).

I found out that filters get a Template::Context object as their first parameter. A few dump later I managed to get the calling template filename via the component entry of the stash. Here is my code :

   sub myCustomFilter {
       my ($context, @arg) = @_;

       my $stash = $context->stash();
       my $component = $stash->get('component');
       my $template_name = $component->{'name'};
   ...
   }

I also need to find out the full path of the calling template.
How can I get it from the Template::Context object ?

Thanks.

Reply via email to