Skip to content
Snippets Groups Projects
Commit 3dbb6c7e authored by Alexander Purr's avatar Alexander Purr Committed by Robert Lange
Browse files

refs #18621 [finc] Remove title attribute from hierarchy tree node

* prevent from shipping redundant title information
* follow up with PR
parent 51dfd560
No related merge requests found
...@@ -142,4 +142,42 @@ class JSTree extends \VuFind\Hierarchy\TreeRenderer\JSTree ...@@ -142,4 +142,42 @@ class JSTree extends \VuFind\Hierarchy\TreeRenderer\JSTree
$this->dataSource->setRecordDriver($this->recordDriver); $this->dataSource->setRecordDriver($this->recordDriver);
return $this->dataSource; 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;
}
} }
...@@ -132,7 +132,8 @@ function buildJSONNodes(xml) { ...@@ -132,7 +132,8 @@ function buildJSONNodes(xml) {
li_attr: { recordid: id.text() }, li_attr: { recordid: id.text() },
a_attr: { a_attr: {
href: name.attr('href'), href: name.attr('href'),
title: name.text() // Remove redundant title attribute - refs #18621
// title: name.text()
}, },
type: name.attr('href').match(/\/Collection\//) ? 'collection' : 'record', type: name.attr('href').match(/\/Collection\//) ? 'collection' : 'record',
children: buildJSONNodes(this) children: buildJSONNodes(this)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment