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/Hook.pm | 31 ++++++++++++++++++++ Bugzilla/Template.pm | 13 +++++++++ extensions/example/code/template-before_process.pl | 33 ++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 extensions/example/code/template-before_process.pl diff --git a/Bugzilla/Hook.pm b/Bugzilla/Hook.pm index 2cd99c3e7..51bce7fbe 100644 --- a/Bugzilla/Hook.pm +++ b/Bugzilla/Hook.pm @@ -649,6 +649,37 @@ to the user. (F's C) =back +=head2 template-before_process + +This hook allows you to define additional variables that will be available to +the template being processed. You probably want to restrict your hook +to operating only if a certain file is being loaded (which is why you +get a C argument below). Otherwise, modifying the C argument +will affect every single template in Bugzilla. + +Params: + +=over + +=item C + +The template vars hashref--these are the values that get passed to the +template. Adding new keys to this hashref will cause those new values +to also get passed to the template. + +=item C + +The name of the template being processed. This is relative +to the main template directory for the language (i.e. for +F