diff --git a/local/config/vufind/Resolver.ini b/local/config/vufind/Resolver.ini new file mode 100644 index 0000000000000000000000000000000000000000..421d09a220eaeb7735c9ea065cfd369b9d97ded6 --- /dev/null +++ b/local/config/vufind/Resolver.ini @@ -0,0 +1,2 @@ +[General] +embed_auto_load = true \ No newline at end of file diff --git a/local/config/vufind/config.ini b/local/config/vufind/config.ini index b573c4f0868f3eeedec4a95274f3347c6ec5cd76..2cee0991b6f2414a52df779edf03a2dabc216945 100644 --- a/local/config/vufind/config.ini +++ b/local/config/vufind/config.ini @@ -908,7 +908,7 @@ embed = false ; results view could perform searches.ini->[General]->default_limit requests). You ; might reduce load on the linkresolver by using the resolver_cache setting (see ; below). -embed_auto_load = false +embed_auto_load = true ; When embed is true, you can set this to an absolute path on your system in order ; to cache link resolver results to disk. Be sure that the chosen directory has diff --git a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php index 8685085072fb57143bcaafc94649b84174d4aa94..de44b3070922eaa627f8a9181cea4dae2bc7a8aa 100644 --- a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php +++ b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php @@ -2211,4 +2211,59 @@ trait SolrMarcFincTrait } return $retval; } + + /** + * + */ + public function getPublicationDetails() { + + $places = + $names = + $dates = []; + foreach (array('260','264') as $pos => $field_name) { + if ($fields = $this->getMarcRecord()->getFields($field_name)) { + foreach ($fields as $field) { + // for MARC $264 if indicator2 equals 1 we have publication details + // others are irrelevant + if ($pos === '264' && $field->getIndicator('2') !== '1') { + continue; + } + foreach (array( + 'places' => 'a', + 'names' => 'b', + 'dates' => 'c' + ) as $key => $sub_name) { + if ($lines = $field->getSubfields($sub_name)) { + ${$key}[] = implode( + ', ', + array_map( + function ($elem) { + return $elem->getData(); + }, + $lines + ) + ); + } else { + ${$key}[] = ''; + } + } + } + } + } + + $i = 0; + $retval = []; + while (isset($places[$i]) || isset($names[$i]) || isset($dates[$i])) { + // Build objects to represent each set of data; these will + // transform seamlessly into strings in the view layer. + $retval[] = new \VuFind\RecordDriver\Response\PublicationDetails( + $places[$i] ?? '', + $names[$i] ?? '', + $dates[$i] ?? '' + ); + $i++; + } + + return $retval; + } } diff --git a/themes/finc/templates/RecordDriver/SolrDefault/data-publicationDetails.phtml b/themes/finc/templates/RecordDriver/SolrDefault/data-publicationDetails.phtml deleted file mode 100644 index df299e1e5b96aa27cc2651a9838e82a4a2dc5f4d..0000000000000000000000000000000000000000 --- a/themes/finc/templates/RecordDriver/SolrDefault/data-publicationDetails.phtml +++ /dev/null @@ -1,32 +0,0 @@ -<!-- finc: RecordDriver - solrDefault - data-publicationDetails --> -<? if (!empty($data)): ?> - <div itemscope itemtype="http://schema.org/publisher"> - <? if (is_array($data) && !empty($data[0]) && $data[0] instanceof \VuFind\RecordDriver\Response\PublicationDetails): ?> - <? foreach ($data as $field): ?> - <span property="publisher" typeof="Organization"> - <? $pubPlace = $field->getPlace(); if (!empty($pubPlace)): ?> - <span property="location" typeof="Place"> - <span property="name"><?=$this->escapeHtml($pubPlace)?></span> - </span> - <? endif; ?> - <? $pubName = $field->getName(); if (!empty($pubName)): ?> - <span property="name"><?=$this->escapeHtml($pubName)?></span> - <? endif; ?> - </span> - <span property="datePublished"> - - <? $pubDate = $field->getDate(); if (!empty($pubDate)): ?> - <?=$this->escapeHtml($pubDate)?> - <? endif; ?> - </span> - <? endforeach; ?> - <? else: ?> - <? if (is_array($data)): ?> - <?= implode('<br/>', array_map(array($this, 'escapeHtml'), $data)) ?> - <? else: ?> - <?= $this->escapeHtml($data) ?> - <? endif; ?> - <? endif ?> - </div> -<? endif ?> -<!-- finc: RecordDriver - solrDefault - data-publicationDetails - END -->