Bug 40972: Add XSLT record processor filter hook for plugins

Koha's XSLT display path now calls a plugin hook so plugins can
extend the record processor filter list before MARC is transformed.
This enables prototype punctuation filters (and similar) to run
as plugins without core changes.

Test plan:
1) Enable plugins in koha-conf.xml.
2) Install the TestPunctuation plugin from https://github.com/HKS3/koha-test-punctuation
3) Enable the plugin in Koha admin.
4) View a biblio in staff or OPAC with XSLT display enabled and confirm
   the filter runs (e.g., 245$a gets a trailing period if missing).

Signed-off-by: Alexander Wagner <alexander.wagner@desy.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Mark Hofstetter 2026-02-06 12:21:29 +01:00 committed by Lucas Gass
parent 61c84f9e6a
commit bb0d94b261
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 16 additions and 2 deletions

View File

@ -39,6 +39,7 @@ use C4::Koha qw( xml_escape );
use C4::Biblio qw( GetAuthorisedValueDesc GetFrameworkCode GetMarcStructure );
use Koha::AuthorisedValues;
use Koha::ItemTypes;
use Koha::Plugins;
use Koha::RecordProcessor;
use Koha::Libraries;
use Koha::Recalls;
@ -197,10 +198,23 @@ sub XSLTParse4Display {
my $xslfilename = get_xsl_filename($xslsyspref);
my $frameworkcode = GetFrameworkCode($biblionumber) || '';
my $frameworkcode = GetFrameworkCode($biblionumber) || '';
my $filters = ['ExpandCodedFields'];
Koha::Plugins->call(
'xslt_record_processor_filters',
{
filters => $filters,
interface => $interface,
frameworkcode => $frameworkcode,
xsl_syspref => $xslsyspref,
biblionumber => $biblionumber,
}
);
my $record_processor = Koha::RecordProcessor->new(
{
filters => ['ExpandCodedFields'],
filters => $filters,
options => {
interface => $interface,
frameworkcode => $frameworkcode