Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
5aba1b12
Commit
5aba1b12
authored
May 29, 2008
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 318205: The path to the hook is incorrect when called from inside a block
Patch By Elliotte Martin <elliotte_martin@yahoo.com> r=mkanat, a=mkanat
parent
e0db56e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
8 deletions
+55
-8
Hook.pm
Bugzilla/Template/Plugin/Hook.pm
+55
-8
No files found.
Bugzilla/Template/Plugin/Hook.pm
View file @
5aba1b12
...
...
@@ -19,6 +19,7 @@
#
# Contributor(s): Myk Melez <myk@mozilla.org>
# Zach Lipton <zach@zachlipton.com>
# Elliotte Martin <everythingsolved.com>
#
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<process>
=over
=item B<Description>
Processes hooks added into templates by extensions.
=item B<Params>
=over
=item C<hook_name>
The unique name of the template hook.
=item C<template> (optional)
The path of the calling template.
This is used as a work around to a bug which causes the path to the hook
to be incorrect when the hook is called from inside a block.
Example: If the hook C<lastrow> is added to the template
F<show-multiple.html.tmpl> and it is desired to force the correct template
path, the template hook would be:
[% Hook.process("lastrow", "bug/show-multiple.html.tmpl") %]
=back
=item B<Returns>
Output from processing template extension.
=back
=back
=head1 SEE ALSO
L<Template::Plugin>
L<http:E<sol>E<sol>www.bugzilla.orgE<sol>docsE<sol>tipE<sol>htmlE<sol>customization.html>
L<http:E<sol>E<sol>bugzilla.mozilla.orgE<sol>show_bug.cgi?id=229658>
L<http:E<sol>E<sol>bugzilla.mozilla.orgE<sol>show_bug.cgi?id=298341>
L<http://www.bugzilla.org/docs/tip/html/customization.html>
L<http://bugzilla.mozilla.org/show_bug.cgi?id=229658>
L<http://bugzilla.mozilla.org/show_bug.cgi?id=298341>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment