diff options
Diffstat (limited to 'Bugzilla/Hook.pm')
-rw-r--r-- | Bugzilla/Hook.pm | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/Bugzilla/Hook.pm b/Bugzilla/Hook.pm index d6ba5e1d0..f5c67c692 100644 --- a/Bugzilla/Hook.pm +++ b/Bugzilla/Hook.pm @@ -12,33 +12,33 @@ use strict; use warnings; sub process { - my ($name, $args) = @_; + my ($name, $args) = @_; - _entering($name); + _entering($name); - foreach my $extension (@{ Bugzilla->extensions }) { - if ($extension->can($name)) { - $extension->$name($args); - } + foreach my $extension (@{Bugzilla->extensions}) { + if ($extension->can($name)) { + $extension->$name($args); } + } - _leaving($name); + _leaving($name); } sub in { - my $hook_name = shift; - my $currently_in = Bugzilla->request_cache->{hook_stack}->[-1] || ''; - return $hook_name eq $currently_in ? 1 : 0; + my $hook_name = shift; + my $currently_in = Bugzilla->request_cache->{hook_stack}->[-1] || ''; + return $hook_name eq $currently_in ? 1 : 0; } sub _entering { - my ($hook_name) = @_; - my $hook_stack = Bugzilla->request_cache->{hook_stack} ||= []; - push(@$hook_stack, $hook_name); + my ($hook_name) = @_; + my $hook_stack = Bugzilla->request_cache->{hook_stack} ||= []; + push(@$hook_stack, $hook_name); } sub _leaving { - pop @{ Bugzilla->request_cache->{hook_stack} }; + pop @{Bugzilla->request_cache->{hook_stack}}; } 1; @@ -1479,6 +1479,21 @@ look at the code for C<create> in L<Bugzilla::Template>.) =back +=head2 template_after_create + +This hook allows you to manipulate the Template object before it is used. +You can use this to define new vmethods or filters in extensions. + +Params: + +=over + +=item C<template> + +This is the L<Bugzilla::Template> object. + +=back + =head2 template_before_process This hook is called any time Bugzilla processes a template file, including |