From bb0d94b26159181ac7e0bf7dc8e2f482ced24acc Mon Sep 17 00:00:00 2001 From: Mark Hofstetter Date: Fri, 6 Feb 2026 12:21:29 +0100 Subject: [PATCH] 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 Signed-off-by: Nick Clemens Signed-off-by: Lucas Gass --- C4/XSLT.pm | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index be3ac7d41f..ddf0cbfe0d 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -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