From 64cce9146d157c771d1410941f7730f0f4b9d3ce Mon Sep 17 00:00:00 2001
From: Alexander Purr <purr@ub.uni-leipzig.de>
Date: Wed, 16 Aug 2023 13:30:24 +0200
Subject: [PATCH] refs #24409 [finc] if record has no hierarchyParentId start
 new Series-search on title * origin refs 23938

---
 .../data-hierarchyParentTitle.phtml           | 21 ++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/data-hierarchyParentTitle.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/data-hierarchyParentTitle.phtml
index c94fdc31745..419f2b1d9f5 100644
--- a/themes/finc/templates/RecordDriver/DefaultRecord/data-hierarchyParentTitle.phtml
+++ b/themes/finc/templates/RecordDriver/DefaultRecord/data-hierarchyParentTitle.phtml
@@ -1,11 +1,30 @@
 <!-- finc: RecordDriver - DefaultRecord - data-hierarchyParentTitle -->
+<?php
+/**
+*
+* origin: self
+*
+* called by view helper/controller:
+*
+* usage:
+* - Shows parent collection title in RECORD VIEW (left-hand side) under 'Teil von:'
+* - Linking to parent title (default by parent-id, if missing by title-string itself)
+*
+* modified for finc: --
+*
+* configured in: --
+*
+**/
+?>
 <?php if (!empty($data)): ?>
   <?php $hierarchyParentId = $this->driver->tryMethod('getHierarchyParentID'); ?>
   <?php foreach ($data as $key => $title): ?>
     <?php if (isset($hierarchyParentId[$key])): ?>
       <a href="<?=$this->recordLink()->getUrl($hierarchyParentId[$key], $hierarchyParentId[$key], 'ParentID');?>"><?=$this->escapeHtml($title)?></a>
     <?php else: ?>
-      <?=$this->escapeHtml($title)?>
+      <?php /* #24409 fallback: if record has no hierarchyParentId start new Series-search on title */ ?>
+      <?php $url = $this->url('search-results', [], ['query'=>['type' => 'Series','lookfor' => $title]])?>
+      <a href="<?=$url?>"><?=$this->escapeHtml($title)?></a>
     <?php endif; ?>
     <br/>
   <?php endforeach; ?>
-- 
GitLab