From 700f6a062970e2c23510e3f6a47c88e069047a04 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Tue, 20 Oct 2009 23:08:03 +0000 Subject: Bug 394438: Add a hook for adding template vars to any page (Override Template->process) Patch by Matt Rogers r=mkanat, a=mkanat --- Bugzilla/Template.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Bugzilla/Template.pm') diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index f94cb2e38..2e2ac4b08 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -79,6 +79,19 @@ sub _load_constants { return \%constants; } +# Overload Template::Process in order to add a hook to allow additional +# variables to be made available by an extension +sub process { + my $self = shift; + my ($file, $vars) = @_; + + Bugzilla::Hook::process("template-before_process", + { vars => $vars, file => $file, + template => $self }); + + return $self->SUPER::process(@_); +} + # Returns the path to the templates based on the Accept-Language # settings of the user and of the available languages # If no Accept-Language is present it uses the defined default -- cgit v1.2.3-24-g4f1b