@@ -, +, @@ structures --- Koha/Template/Plugin/KohaPlugins.pm | 52 +++++++++++++++++++ catalogue/detail.pl | 7 +-- catalogue/search.pl | 7 +-- .../prog/en/modules/catalogue/detail.tt | 14 +++-- .../prog/en/modules/catalogue/results.tt | 11 ++-- .../bootstrap/en/modules/opac-detail.tt | 12 +++-- .../bootstrap/en/modules/opac-results.tt | 31 ++++------- opac/opac-detail.pl | 7 +-- opac/opac-search.pl | 7 +-- 9 files changed, 99 insertions(+), 49 deletions(-) --- a/Koha/Template/Plugin/KohaPlugins.pm +++ a/Koha/Template/Plugin/KohaPlugins.pm @@ -194,4 +194,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; --- a/catalogue/detail.pl +++ a/catalogue/detail.pl @@ -60,6 +60,7 @@ use Koha::Recalls; use Koha::SearchEngine::Search; use Koha::SearchEngine::QueryBuilder; use Koha::Serial::Items; +use Koha::Template::Plugin::KohaPlugins; my $query = CGI->new(); @@ -684,9 +685,9 @@ $template->param(found1 => scalar $query->param('found1') ); $template->param(biblio => $biblio); -my $intranet_js_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_js; -if(index($intranet_js_plugins, "Cover Image Plugin") != -1){ - $template->param( Cover_Images_Required => 1 ) +my $intranet_cover_images_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_cover_images; +if($intranet_cover_images_plugins){ + $template->param( CoverImagesRequired => 1 ) } output_html_with_http_headers $query, $cookie, $template->output; --- a/catalogue/search.pl +++ a/catalogue/search.pl @@ -158,6 +158,7 @@ use Koha::SearchEngine::QueryBuilder; use Koha::Virtualshelves; use Koha::SearchFields; use Koha::SearchFilters; +use Koha::Template::Plugin::KohaPlugins; use URI::Escape; use JSON qw( decode_json encode_json ); @@ -779,9 +780,9 @@ my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( } ); -my $intranet_js_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_js; -if(index($intranet_js_plugins, "Cover Image Plugin") != -1){ - $template->param( Cover_Images_Required => 1 ) +my $intranet_cover_images_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_cover_images; +if($intranet_cover_images_plugins){ + $template->param( CoverImagesRequired => 1 ) } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -114,7 +114,7 @@ [% END %] - [% IF ( Cover_Images_Required || AmazonCoverImages || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %] + [% IF ( CoverImagesRequired || AmazonCoverImages || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]