diff --git a/module/finc/src/finc/Hierarchy/TreeRenderer/JSTree.php b/module/finc/src/finc/Hierarchy/TreeRenderer/JSTree.php index 16364aac71a26f93c261fe0e72c459adbd5315b8..66943372c9cfde2d0ce9ed69b61741489443114e 100644 --- a/module/finc/src/finc/Hierarchy/TreeRenderer/JSTree.php +++ b/module/finc/src/finc/Hierarchy/TreeRenderer/JSTree.php @@ -142,4 +142,42 @@ class JSTree extends \VuFind\Hierarchy\TreeRenderer\JSTree $this->dataSource->setRecordDriver($this->recordDriver); return $this->dataSource; } + + /** + * Almost complete copy from vufind's JStree: + * remove just title attribute + * + * @param object $node JSON object of a node/top node + * @param string $context Record or Collection + * @param string $hierarchyID Collection ID + * + * @return array + * + * @inheritdoc + */ + protected function buildNodeArray($node, $context, $hierarchyID) + { + $escaper = new \Laminas\Escaper\Escaper('utf-8'); + $ret = [ + 'id' => preg_replace('/\W/', '-', $node->id), + 'text' => $escaper->escapeHtml($node->title), + 'li_attr' => [ + 'recordid' => $node->id + ], + 'a_attr' => [ + 'href' => $this->getContextualUrl($node, $context), + // Remove redundant title attribute - refs #18621 + //'title' => $node->title + ], + 'type' => $node->type + ]; + if (isset($node->children)) { + $ret['children'] = []; + for ($i = 0;$i < count($node->children);$i++) { + $ret['children'][$i] = $this + ->buildNodeArray($node->children[$i], $context, $hierarchyID); + } + } + return $ret; + } } diff --git a/themes/finc/js/hierarchyTree.js b/themes/finc/js/hierarchyTree.js index 99dcab2b8801a6410f56cf74650368142298fbc4..262e84c251901d049ec4926f05a8588aef7ef0b5 100644 --- a/themes/finc/js/hierarchyTree.js +++ b/themes/finc/js/hierarchyTree.js @@ -132,7 +132,8 @@ function buildJSONNodes(xml) { li_attr: { recordid: id.text() }, a_attr: { href: name.attr('href'), - title: name.text() + // Remove redundant title attribute - refs #18621 + // title: name.text() }, type: name.attr('href').match(/\/Collection\//) ? 'collection' : 'record', children: buildJSONNodes(this)