From c031d40421dc430fe272cba10e09663e2308d99c Mon Sep 17 00:00:00 2001
From: Dorian Merz <merz@ub.uni-leipzig.de>
Date: Tue, 1 Sep 2020 14:05:02 +0200
Subject: [PATCH] refs #18268 [finc] use MultiLine specs for some data fields

---
 .../Root/RecordDataFormatterFactory.php       | 56 +++++++------------
 1 file changed, 21 insertions(+), 35 deletions(-)

diff --git a/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php b/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php
index 295fa647778..a42c9843325 100644
--- a/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php
+++ b/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php
@@ -43,6 +43,9 @@ use VuFind\View\Helper\Root\RecordDataFormatter;
  */
 class RecordDataFormatterFactory
 {
+
+    use MultiDataFieldsTrait;
+
     /**
      * Create the helper.
      *
@@ -267,15 +270,10 @@ class RecordDataFormatterFactory
             'getLanguages',
             'data-transEscCommaSepLang.phtml'
         );
-        $spec->setTemplateLine(
+        $spec->setMultiLine(
             'Additionals',
             'getAdditionals',
-            'data-additionals.phtml',
-            [
-                'labelFunction' => function () {
-                    return null;
-                }
-            ]
+            [$this,'additionals']
         );
         return $spec->getArray();
     }
@@ -428,27 +426,20 @@ class RecordDataFormatterFactory
             'getAllRecordLinks',
             'data-allRecordLinks.phtml'
         );
-        $spec->setTemplateLine(
+        $spec->setMultiLine(
             'Additionals',
             'getAdditionals',
-            'data-additionals.phtml',
-            [
-                'labelFunction' => function () {
-                    return null;
-                }
-            ]
+            [$this,'additionals']
         );
         $spec->setTemplateLine(
             'Source',
             'getMegaCollection',
             'data-escapeHtml.phtml'
         );
-        $spec->setTemplateLine(
-            null,
+        $spec->setMultiLine(
+            "Other Relationship Entry",
             'getOtherRelationshipEntry',
-            'data-otherRelationshipEntry.phtml',
-            [
-            ]
+            [$this,'otherRelationshipEntry']
         );
         $spec->setTemplateLine(
             'Notes',
@@ -750,15 +741,10 @@ class RecordDataFormatterFactory
                 'context' => ['class' => 'recordIdentifiers']
             ]
         );
-        $spec->setTemplateLine(
+        $spec->setMultiLine(
             'Events',
-            true,
-            'data-events.phtml',
-            [
-                'labelFunction' => function () {
-                    return null;
-                }
-            ]
+            'getEvents',
+            [$this,'events']
         );
         // , context: "recordEvents"
         $spec->setTemplateLine(
@@ -914,6 +900,11 @@ class RecordDataFormatterFactory
             'data-childRecords.phtml',
             ['allowZero' => false]
         );
+        $spec->setMultiLine(
+            'Additionals',
+            'getAdditionals',
+            [$this,'additionals']
+        );
         /* finc: remove 'Online Access' in record-details #13770 - VE */
         /* $spec->setTemplateLine('Online Access', true, 'data-onlineAccess.phtml'); */
         $spec->setTemplateLine(
@@ -936,15 +927,10 @@ class RecordDataFormatterFactory
             'getMegaCollection',
             'data-escapeHtml.phtml'
         );
-        $spec->setTemplateLine(
-            'OtherRelationshipEntry',
+        $spec->setMultiLine(
+            "Other Relationship Entry",
             'getOtherRelationshipEntry',
-            'data-otherRelationshipEntry.phtml',
-            [
-                'labelFunction' => function () {
-                    return null;
-                }
-            ]
+            [$this,'otherRelationshipEntry']
         );
         $spec->setTemplateLine(
             'Notes',
-- 
GitLab