This was accidentally included in the 5.0.4 branch, which should have branched just before this commit. Everything else after it before we did end up branching would have been cherry-picked anyway.
=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
Bugzilla::Hook::process('template_before_create', { config => $config });
my $template = $class->new($config)
|| die("Template creation failed: " . $class->error());
- Bugzilla::Hook::process('template_after_create', { template => $template });
# Pass on our current language to any template hooks or inner templates
# called by this Template object.
$config->{VARIABLES}->{example_global_variable} = sub { return 'value' };
}
-sub template_after_create {
- my ( $self, $args ) = @_;
- my $context = $args->{template}->context;
-
- # define a pluck method on template toolkit lists.
- $context->define_vmethod(
- list => pluck => sub {
- my ( $list, $field ) = @_;
- return [ map { $_->$field } @$list ];
- }
- );
-}
-
sub template_before_process {
my ($self, $args) = @_;