Bug 32680: Add cover images plugin hook

This patch adds a plugin hook to inject cover images into the templates

Test plan:
1) Apply all patches
2) Go to https://github.com/PTFS-Europe/koha-plugin-addBDSCovers
3) In the releases section, download the .kpz file
4) Upload this in the plugins section and enable the plugin
5) In either the OPAC or staff client, search the catalog
6) The results should have cover art from BDS covers
7) Click on a result and the detail page should also have the cover art

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Matt Blenkinsop 2023-04-19 11:21:02 +00:00 committed by Tomas Cohen Arazi
parent 9848074b3c
commit 728e687290
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -230,4 +230,56 @@ sub get_plugins_intranet_catalog_biblio_tab {
return $tabs;
}
=head3 get_plugins_intranet_cover_images
[% KohaPlugins. get_plugins_intranet_cover_images %]
This method collects the output of all plugins for injecting cover images into the intranet template and appends it to the javascript at the bottom of the page.
=cut
sub get_plugins_intranet_cover_images {
return q{} unless C4::Context->config("enable_plugins");
my $p = Koha::Plugins->new();
return q{} unless $p;
my @plugins = $p->GetPlugins(
{
method => 'intranet_cover_images',
}
);
my @data = map { $_->intranet_cover_images || q{} } @plugins;
return join( "\n", @data );
}
=head3 get_plugins_opac_cover_images
[% KohaPlugins. get_plugins_opac_cover_images %]
This method collects the output of all plugins for injecting cover images into the opac template and appends it to the javascript at the bottom of the page.
=cut
sub get_plugins_opac_cover_images {
return q{} unless C4::Context->config("enable_plugins");
my $p = Koha::Plugins->new();
return q{} unless $p;
my @plugins = $p->GetPlugins(
{
method => 'opac_cover_images',
}
);
my @data = map { $_->opac_cover_images || q{} } @plugins;
return join( "\n", @data );
}
1;