return @responses;
}
=head2 call_apply
Calls a plugin method for all enabled plugins, reworking on the same input and returning it.
ideally the caller of a plugin must not know how to merge the results
so maybe also implement a "merge" method in the plugin
@responses = Koha::Plugins->call_apply($method, $work_var, @args)
=cut
sub call_apply {
my ($class, $method, $work_var, @args) = @_;
if (C4::Context->config('enable_plugins')) {
my @plugins = $class->new({ enable_plugins => 1 })->GetPlugins({ method => $method });
@plugins = grep { $_->can($method) } @plugins;
foreach my $plugin (@plugins) {
my $work_var = eval { $plugin->$method($work_var, @args) };
if ($@) {
warn sprintf("Plugin error (%s): %s", $plugin->get_metadata->{name}, $@);
next;
return $work_var;
=head2 GetPlugins
$variables = { %$variables, %$plugin_variables };
$record = Koha::Plugins->call_apply(
'munge_record',
$record,
{
patron => $patron,
interface => 'opac',
caller => 'opac-detail',
);
$template->param(
XSLTBloc => XSLTParse4Display(
$biblionumber, $record, "OPACXSLTDetailsDisplay", 1, undef,