summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-10-21 01:08:03 +0200
committermkanat%bugzilla.org <>2009-10-21 01:08:03 +0200
commit700f6a062970e2c23510e3f6a47c88e069047a04 (patch)
treed53c1c06e4f64c4978d666be6131258d1582e1bd /extensions
parent41d57c9f222ccf154eda5ecc2db94b406029a71c (diff)
downloadbugzilla-700f6a062970e2c23510e3f6a47c88e069047a04.tar.gz
bugzilla-700f6a062970e2c23510e3f6a47c88e069047a04.tar.xz
Bug 394438: Add a hook for adding template vars to any page (Override Template->process)
Patch by Matt Rogers <mattr@kde.org> r=mkanat, a=mkanat
Diffstat (limited to 'extensions')
-rw-r--r--extensions/example/code/template-before_process.pl33
1 files changed, 33 insertions, 0 deletions
diff --git a/extensions/example/code/template-before_process.pl b/extensions/example/code/template-before_process.pl
new file mode 100644
index 000000000..66f9a56f6
--- /dev/null
+++ b/extensions/example/code/template-before_process.pl
@@ -0,0 +1,33 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Example Plugin.
+#
+# The Initial Developer of the Original Code is Matt Rogers.
+# Portions created by the Initial Developer are Copyright (C) 2009
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Matt Rogers <mattr@kde.org>
+
+use strict;
+use warnings;
+use Bugzilla;
+
+my %args = %{ Bugzilla->hook_args };
+my ($vars, $file, $template) = $args{qw(vars file template)};
+
+$vars->{'example'} = 1;
+
+if ($file =~ m{^bug/show}) {
+ $vars->{'showing_a_bug'} = 1;
+}