From: mkanat%bugzilla.org <> Date: Thu, 29 May 2008 03:46:28 +0000 (+0000) Subject: Bug 318205: the path to the hook is incorrect when called from inside a block X-Git-Tag: bugzilla-3.2rc1~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d76637cc4dc8185ee3b666b94092a3bf477e070a;p=thirdparty%2Fbugzilla.git Bug 318205: the path to the hook is incorrect when called from inside a block Patch By Elliotte Martin r=mkanat, a=mkanat --- diff --git a/Bugzilla/Template/Plugin/Hook.pm b/Bugzilla/Template/Plugin/Hook.pm index 4e3bf5cefc..05a1fdfd1b 100644 --- a/Bugzilla/Template/Plugin/Hook.pm +++ b/Bugzilla/Template/Plugin/Hook.pm @@ -19,6 +19,7 @@ # # Contributor(s): Myk Melez # Zach Lipton +# Elliotte Martin # package Bugzilla::Template::Plugin::Hook; @@ -45,12 +46,11 @@ sub new { } sub process { - my ($self, $hook_name) = @_; + my ($self, $hook_name, $template) = @_; + $template ||= $self->{_CONTEXT}->stash->{component}->{name}; + + my @hooks; - my $paths = $self->{_CONTEXT}->{LOAD_TEMPLATES}->[0]->paths; - my $template = $self->{_CONTEXT}->stash->{component}->{name}; - my @hooks = (); - # sanity check: if (!$template =~ /[\w\.\/\-_\\]+/) { ThrowCodeError('template_invalid', { name => $template}); @@ -79,6 +79,8 @@ sub process { } } } + + my $paths = $self->{_CONTEXT}->{LOAD_TEMPLATES}->[0]->paths; # we keep this too since you can still put hook templates in # template/en/custom/hook @@ -116,9 +118,54 @@ Bugzilla::Template::Plugin::Hook Template Toolkit plugin to process hooks added into templates by extensions. +=head1 METHODS + +=over + +=item B + +=over + +=item B + +Processes hooks added into templates by extensions. + +=item B + +=over + +=item C + +The unique name of the template hook. + +=item C