Bug 28026: Add call_recursive() as a supplement for call()
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 23 Mar 2021 16:07:20 +0000 (16:07 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 6 Oct 2021 12:56:09 +0000 (14:56 +0200)
commitfc68d49897900fb365e3016ba38fbc10be77d14f
tree63316cb704d3d9a6846645c3f7fd95cedb380231
parent7ce74ab1330b4eedfa3502c85a4a6b8bdb009bd9
Bug 28026: Add call_recursive() as a supplement for call()

The method call() is not sufficient for all plugin hook types. It's
possible that more than one plugin will be installed that wants to
return the arguaments passed in an updated form.  These transformation
plugins need to work recursively rather than independantly.

This patch adss a `call_recursive()` method that takes the output of
the first plugin and uses it as the input for the next plugin and so
on. This allowes each plugin to see the current version of the arguament
list and modify it as necessary.

Test plan
1/ Run the included tests - t/db_dependent/Koha/Plugins/Plugins.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Plugins.pm
t/db_dependent/Koha/Plugins/Plugins.t
t/lib/Koha/Plugin/Test.pm