diff --git a/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php b/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php index d31e09f4842199442225196a375a4819f98d1d44..6e1ea01c23cf95069fff2f32ccf7fab1349a2701 100644 --- a/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php +++ b/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php @@ -92,12 +92,8 @@ class RecordDataFormatterFactory [$this, 'getMarcCoreSpecs'] ); $helper->setDefaults( - 'rvk', - [$this, 'getRvkSpecs'] - ); - $helper->setDefaults( - 'topics', - [$this, 'getTopicsSpecs'] + 'topics-tab', + [$this, 'getTopicsTabSpecs'] ); return $helper; @@ -921,35 +917,24 @@ class RecordDataFormatterFactory ); return $spec->getArray(); } - + /** - * Get marc specifications for displaying rvk. + * Get default specifications for displaying data in the topics tab. * * @return array */ - public function getRvkSpecs() + public function getTopicsTabSpecs() { $spec = new RecordDataFormatter\SpecBuilder(); $spec->setTemplateLine( - 'Topics', + 'RVK', 'getRvkWithMetadata', - 'data-rvk.phtml' + 'data-rvkNotation.phtml' ); - return $spec->getArray(); - } - - /** - * Get marc specifications for displaying topics. - * - * @return array - */ - public function getTopicsSpecs() - { - $spec = new RecordDataFormatter\SpecBuilder(); $spec->setTemplateLine( - 'Topics', + 'Subjects', 'getTopics', - 'data-topics.phtml' + 'data-allSubjectHeadingsWithExtended.phtml' ); return $spec->getArray(); } diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/data-rvk.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/data-rvk.phtml deleted file mode 100644 index b113b53c7c9366f25cccbebd4de45742462601e9..0000000000000000000000000000000000000000 --- a/themes/finc/templates/RecordDriver/DefaultRecord/data-rvk.phtml +++ /dev/null @@ -1,26 +0,0 @@ -<!-- finc: RecordDriver - DefaultRecord - data-rvk --> -<tr> - <th><?=$this->transEsc('RVK')?>:</th> - <td data-title="<?= $this->transEsc('RVK') ?>:"> - <?php $i = 0; foreach ($data as $item): ?> - <?=($i > 0 ? "<br />" : "") //no linebreak after last item?> - <?=$item['rvk']?> - <?php if (isset($item['level']) || isset($item['name'])): ?> - <?php - $tooltip_content = "<ul class='no-bullet'>" . (isset($item['name']) ? "<li><strong>" . $item['name'] . "</strong></li>" : ""); - if (isset($item['level']) && count($item['level'])) { - foreach ($item['level'] as $level) { - $tooltip_content .= "<li>" . $level . "</li>"; - } - } - $tooltip_content .= "</ul>"; - ?> - <?php endif; ?> - <span <?=(isset($tooltip_content) ? 'data-toggle="tooltip" data-html="true" title="' . $tooltip_content . '"' : "")?>> - <a href="<?=$this->record($this->driver)->getLink('rvk', $item['rvk'])?>"> <i class="fa fa-search" aria-hidden="true"></i> <?=$this->transEsc('Find Similar Items');?></a> - </span> - <?php $i++; ?> - <?php endforeach; ?> - </td> -</tr> -<!-- finc: RecordDriver - DefaultRecord - data-rvk - END --> diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/data-topics.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/data-topics.phtml deleted file mode 100644 index d0276526570eac7a531d3362e9416630abe6744f..0000000000000000000000000000000000000000 --- a/themes/finc/templates/RecordDriver/DefaultRecord/data-topics.phtml +++ /dev/null @@ -1,25 +0,0 @@ -<!-- finc: RecordDriver - DefaultRecord - data-topics --> -<tr> - <th><?=$this->transEsc('Subjects')?>: </th> - <td data-title="<?= $this->transEsc('Subjects') ?>:"> - <?php foreach ($data as $field): ?> - <div class="subject-line" property="keywords"> - <?php $subject = ''; ?> - <?php - if (count($field) == 1 && !isset($field['subject'])) { - $field = explode('--', $field[0]); - } - ?> - <?php if (isset($field['subject'])): /* extended topics */?> - <?php $field = $field['subject']; ?> - <?php endif; ?> - <?php $i = 0; foreach ($field as $subfield): ?> - <?=($i++ == 0) ? '' : ' > '?> - <?php $subject = trim($subject . ' ' . $subfield); ?> - <a title="<?=$this->escapeHtmlAttr($subject)?>" href="<?=$this->record($this->driver)->getLink('subject', $subject)?>" rel="nofollow"><?=trim($this->escapeHtml($subfield))?></a> - <?php endforeach; ?> - </div> - <?php endforeach; ?> - </td> -</tr> -<!-- finc: RecordDriver - DefaultRecord - data-topics - END --> diff --git a/themes/finc/templates/RecordTab/topics.phtml b/themes/finc/templates/RecordTab/topics.phtml index 7e7d46803351f161e13563d87143fcd18bc38bd0..c6e063a786c23ab408c5809e5961d5623fe21c9d 100644 --- a/themes/finc/templates/RecordTab/topics.phtml +++ b/themes/finc/templates/RecordTab/topics.phtml @@ -1,18 +1,32 @@ <!-- finc: recordtab - topics --> +<?php /* template copied from themes/finc/templates/RecordTab/description.phtml + same display logic */ ?> <?php -// Set page title. -$this->headTitle($this->translate('Topics') . ': ' . $this->driver->getBreadcrumb()); -$formatter = $this->recordDataFormatter(); -$rvk = $formatter->getData($this->driver, $formatter->getDefaults('rvk')); -$topics = $formatter->getData($this->driver, $formatter->getDefaults('topics')); + // Set page title. + $this->headTitle($this->translate('Topics') . ': ' . $this->driver->getBreadcrumb()); + + $formatter = $this->recordDataFormatter(); + $mainFields = $formatter->getData($driver, $formatter->getDefaults('topics-tab')); ?> +<?php /* finc: remove schema tag here but keep in core, include responsive data table - CK */ ?> <table class="table table-striped table-resp-data"> + <?php + /* Table gets filled via recordDriver/.../data-... templates as referenced in RecordDataFormatterFactory */ ?> <caption><span class="sr-only"><?=$this->transEsc('Topics')?></span></caption> - <?php foreach ($rvk as $rvkItem): ?> - <?= $rvkItem['value'] ?? ''?> - <?php endforeach; ?> - <?php foreach ($topics as $topicsItem): ?> - <?= $topicsItem['value'] ?? ''?> - <?php endforeach; ?> + <?php if (!empty($mainFields)): ?> + <?php foreach ($mainFields as $current): ?> + <tr> + <?php if (!empty($current['label'])): ?> + <th><?=$this->transEsc($current['label'])?>:</th> + <td lang="" data-title="<?= $this->transEsc($current['label']) ?>:"> + <?php else: ?> + <td lang="" colspan="2"> + <?php endif; ?> + <?=$current['value']?></td> + </tr> + <?php endforeach; ?> + <?php else: ?> + <tr><td><?=$this->transEsc('no_description')?></td></tr> + <?php endif; ?> </table> <!-- finc: recordtab - topics - END -->