diff options
Diffstat (limited to 'extensions/Example/Extension.pm')
-rw-r--r-- | extensions/Example/Extension.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm index dbc84df72..c4fabe656 100644 --- a/extensions/Example/Extension.pm +++ b/extensions/Example/Extension.pm @@ -920,6 +920,19 @@ sub template_before_create { $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) = @_; |