Bug 19605: Rename method and use the instantiated plugin in the call
This patch makes the backend instantiation happen through a plugin
object method instead of a static one. This way, the (already)
instantiated plugin can be reused (if needed) in the plugin workflow
like this:
sub new_il_backend {
my ($self, $params) = @_;
return Custom::Backend->new(
{
config => $params->{config},
logger => $params->{logger},
plugin => $self,
}
);
}
The passed plugin object would then be used to retrieve whatever
plugin-defined configurations, template paths or even helper methods. On
INN-Reach, it gives the backend access to API user agents, task queue
injection, etc.
This patch also renames the method so it is more straight-forward this is
related to ILL.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
a78753367d
commit
e06cd47e25
|
|
@ -436,13 +436,11 @@ sub load_backend {
|
|||
"An invalid backend ID was requested ('')");
|
||||
}
|
||||
|
||||
# Find plugin implementing the backend for the request
|
||||
my $backend_plugin = $self->get_backend_plugin($backend_name);
|
||||
if ($backend_plugin) {
|
||||
|
||||
# New way of loading backends: Through plugins
|
||||
my $backend_plugin_class = $backend_plugin->{class};
|
||||
|
||||
$self->{_my_backend} = $backend_plugin_class->new_backend(
|
||||
$self->{_my_backend} = $backend_plugin->new_ill_backend(
|
||||
{
|
||||
config => $self->_config,
|
||||
logger => Koha::Illrequest::Logger->new
|
||||
|
|
@ -450,7 +448,7 @@ sub load_backend {
|
|||
);
|
||||
} elsif ($backend_name) {
|
||||
|
||||
# Old way of loading backends: Through backend_dir config
|
||||
# Fallback to loading through backend_dir config
|
||||
my @raw = qw/Koha Illbackends/; # Base Path
|
||||
my $location = join "/", @raw, $backend_name, "Base.pm"; # File to load
|
||||
my $backend_class = join "::", @raw, $backend_name, "Base"; # Package name
|
||||
|
|
|
|||
Loading…
Reference in New Issue