Browse Source

Bug 26803: Fix PLUGIN_DIR when plugin_dirs is multivalued

When plugin_dir koha-conf.xml parameter contains more than one
directory, PLUGIN_DIR parameter sent to templates doesn't contain the
proper value, ie the base directory of the current plugin.

See bug 23237

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Frédéric Demians 4 years ago
committed by Jonathan Druart
parent
commit
6f272a16b2
  1. 18
      Koha/Plugins/Base.pm

18
Koha/Plugins/Base.pm

@ -167,7 +167,7 @@ sub get_template {
CLASS => $self->{'class'}, CLASS => $self->{'class'},
METHOD => scalar $self->{'cgi'}->param('method'), METHOD => scalar $self->{'cgi'}->param('method'),
PLUGIN_PATH => $self->get_plugin_http_path(), PLUGIN_PATH => $self->get_plugin_http_path(),
PLUGIN_DIR => $self->get_plugin_dir(), PLUGIN_DIR => $self->bundle_path(),
LANG => C4::Languages::getlanguage($self->{'cgi'}), LANG => C4::Languages::getlanguage($self->{'cgi'}),
); );
@ -215,22 +215,6 @@ sub get_plugin_http_path {
return "/plugin/" . join( '/', split( '::', $self->{'class'} ) ); return "/plugin/" . join( '/', split( '::', $self->{'class'} ) );
} }
=head2 get_plugin_dir
To [% INCLUDE %] another TT template from a template, an absolute path to the
template is required. This method returns that absolute file system path.
usage: my $path = $self->get_plugin_dir();
=cut
sub get_plugin_dir {
my ($self) = @_;
my $base = C4::Context->config('pluginsdir');
return "$base/" . join( '/', split( '::', $self->{'class'} ) );
}
=head2 go_home =head2 go_home
go_home is a quick redirect to the Koha plugins home page go_home is a quick redirect to the Koha plugins home page

Loading…
Cancel
Save