1 package Koha
::Template
::Plugin
::KohaPlugins
;
3 # This file is part of Koha.
5 # Copyright ByWater Solutions 2018
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 use base
qw( Template::Plugin );
28 Koha::Template::Plugin::KohaPlugins - A module for adding hooks into Koha for plugins
32 This plugin contains functions related to adding plugin hooks into various parts
35 To use, include the line '[% USE KohaPlugins %]' at the top of the template
40 =head3 get_plugins_opac_head
42 [% KohaPlugins.get_plugins_opac_head %]
44 This method collects the output of all plugins with an opac_head method
45 to output to the head section of opac pages.
49 sub get_plugins_opac_head
{
51 unless C4
::Context
->preference('UseKohaPlugins');
53 my $p = Koha
::Plugins
->new();
57 my @plugins = $p->GetPlugins(
59 method
=> 'opac_head',
63 my @data = map { $_->opac_head || q{} } @plugins;
65 return join( "\n", @data );
68 =head3 get_plugins_opac_js
70 [% KohaPlugins.get_plugins_opac_js %]
72 This method collects the output of all plugins with an opac_js method
73 to output to the javascript section of at the bottom of opac pages.
77 sub get_plugins_opac_js
{
79 unless C4
::Context
->preference('UseKohaPlugins');
81 my $p = Koha
::Plugins
->new();
85 my @plugins = $p->GetPlugins(
91 my @data = map { $_->opac_js || q{} } @plugins;
93 return join( "\n", @data );
96 =head3 get_plugins_intranet_head
98 [% KohaPlugins.get_plugins_intranet_head %]
100 This method collects the output of all plugins with an intranet_head method
101 to output to the head section of intranet pages.
105 sub get_plugins_intranet_head
{
107 unless C4
::Context
->preference('UseKohaPlugins');
109 my $p = Koha
::Plugins
->new();
111 return q{} unless $p;
113 my @plugins = $p->GetPlugins(
115 method
=> 'intranet_head',
119 my @data = map { $_->intranet_head || q{} } @plugins;
121 return join( "\n", @data );
124 =head3 get_plugins_intranet_js
126 [% KohaPlugins.get_plugins_intranet_js %]
128 This method collects the output of all plugins with an intranet_js method
129 to output to the javascript section of at the bottom of intranet pages.
133 sub get_plugins_intranet_js
{
135 unless C4
::Context
->preference('UseKohaPlugins');
137 my $p = Koha
::Plugins
->new();
139 return q{} unless $p;
141 my @plugins = $p->GetPlugins(
143 method
=> 'intranet_js',
147 my @data = map { $_->intranet_js || q{} } @plugins;
149 return join( "\n", @data );