diff --git a/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php b/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php index 430cca1e8b7370e388469a0d5071b50cc17d05ab..b256aae34cba66ad2d9ee50b724a116d91bf472a 100644 --- a/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php +++ b/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php @@ -54,6 +54,12 @@ class RecordDataFormatterFactory { $helper = new RecordDataFormatter(); + $helper->setDefaults( + 'collection-info', [$this, 'getDefaultCollectionInfoSpecs'] + ); + $helper->setDefaults( + 'collection-record', [$this, 'getDefaultCollectionRecordSpecs'] + ); $helper->setDefaults('core', [$this, 'getDefaultCoreSpecs']); $helper->setDefaults( 'description', [$this, 'getDefaultDescriptionSpecs'] @@ -135,6 +141,131 @@ class RecordDataFormatterFactory return $spec->getArray(); } + /** + * Get default specifications for displaying data in collection-info metadata. + * + * @return array + */ + public function getDefaultCollectionInfoSpecs() + { + $spec = new RecordDataFormatter\SpecBuilder(); + $spec->setTemplateLine( + 'Authors/Corporations', + 'getDeduplicatedAuthors', + 'data-authors.phtml', + [ + 'useCache' => true, + 'context' => [ + 'requiredDataFields' => [ + ['name' => 'role', 'prefix' => 'CreatorRoles::'] + ] + ] + ] + ); + $spec->setTemplateLine( + 'Title', 'getTitleDetails', 'data-titleDetails.phtml' + ); + $spec->setTemplateLine( + 'Dates of publication', 'getDateSpan', 'data-escapeHtml.phtml' + ); + $spec->setTemplateLine( + 'Summary', 'getSummary', 'data-escapeHtml.phtml' + ); + $spec->setTemplateLine( + 'Published', 'getPublicationDetails', 'data-publicationDetails.phtml' + ); + $spec->setLine( + 'Edition', 'getEdition', null, + ['prefix' => '<span property="bookEdition">', 'suffix' => '</span>'] + ); + $spec->setTemplateLine( + 'Subjects', 'getAllSubjectHeadings', 'data-allSubjectHeadings.phtml' + ); + $spec->setTemplateLine( + 'Online Access', true, 'data-onlineAccess.phtml' + ); + $spec->setTemplateLine( + 'Item Description', 'getGeneralNotes', 'data-escapeHtml.phtml' + ); + $spec->setTemplateLine( + 'Production Credits', + 'getProductionCredits', + 'data-escapeHtml.phtml' + ); + $spec->setTemplateLine( + 'Set Multipart', + 'getHierarchyParentTitle', + 'data-hierarchyParentTitle.phtml' + ); + $spec->setTemplateLine( + 'ISBN', 'getISBNs', 'data-escapeHtml.phtml' + ); + $spec->setTemplateLine( + 'ISSN', 'getISSNs', 'data-escapeHtml.phtml' + ); + $spec->setTemplateLine( + 'Notes', + 'getAdditionalNotes', + 'data-escapeHtml.phtml', + [ + 'useCache' => true + ] + ); + $spec->setLine( + 'Format', 'getFormats', 'RecordHelper', + ['helperMethod' => 'getFormatList'] + ); + $spec->setTemplateLine( + 'Language', 'getLanguages', 'data-escapeHtml.phtml' + ); + $spec->setTemplateLine( + 'Additionals', + 'getAdditionals', + 'data-additionals.phtml', + [ + 'labelFunction' => function() { return null; } + ] + ); + return $spec->getArray(); + } + + /** + * Get default specifications for displaying data in collection-record metadata. + * + * @return array + */ + public function getDefaultCollectionRecordSpecs() + { + $spec = new RecordDataFormatter\SpecBuilder(); + $spec->setLine('Summary', 'getSummary'); + $spec->setTemplateLine( + 'Authors/Corporations', + 'getDeduplicatedAuthors', + 'data-authors.phtml', + [ + 'useCache' => true, + 'context' => [ + 'requiredDataFields' => [ + ['name' => 'role', 'prefix' => 'CreatorRoles::'] + ] + ] + ] + ); + $spec->setTemplateLine( + 'Language', 'getLanguages', 'data-escapeHtml.phtml' + ); + $spec->setLine( + 'Format', 'getFormats', 'RecordHelper', + ['helperMethod' => 'getFormatList'] + ); + $spec->setTemplateLine( + 'Access', 'getAccessRestrictions', 'data-escapeHtml.phtml' + ); + $spec->setTemplateLine( + 'Related Items', 'getRelationshipNotes', 'data-escapeHtml.phtml' + ); + return $spec->getArray(); + } /** * Get default specifications for displaying data in core metadata. diff --git a/themes/finc/templates/RecordDriver/SolrDefault/collection-info.phtml b/themes/finc/templates/RecordDriver/SolrDefault/collection-info.phtml index 2215d787c0e93b2f5d250d04218c2dc14861431f..185ff5dfeeba93c1a26e53a5f2ef5b343d297c31 100644 --- a/themes/finc/templates/RecordDriver/SolrDefault/collection-info.phtml +++ b/themes/finc/templates/RecordDriver/SolrDefault/collection-info.phtml @@ -51,7 +51,11 @@ <? /* Table summary not supported in html 5, finc-specific solution, CK */ ?> <caption class="sr-only"><?=$this->transEsc('Bibliographic Details')?></caption> <? foreach ($fields as $key => $current): ?> - <tr><th><?=$this->transEsc($key)?>:</th><td><?=$current['value']?></td></tr> + <? if ($key == null): ?> + <?=$current['value']?> + <? else: ?> + <tr><th><?=$this->transEsc($key)?>:</th><td><?=$current['value']?></td></tr> + <? endif; ?> <? endforeach; ?> </table> <? endif; ?> diff --git a/themes/finc/templates/RecordDriver/SolrDefault/collection-record.phtml b/themes/finc/templates/RecordDriver/SolrDefault/collection-record.phtml index 40a043a32bcfd020ec52df83d0c9055bce6e7c7c..e15e4cd91790919e4088b1aaca4008f6fdc3ec1f 100644 --- a/themes/finc/templates/RecordDriver/SolrDefault/collection-record.phtml +++ b/themes/finc/templates/RecordDriver/SolrDefault/collection-record.phtml @@ -13,7 +13,11 @@ $fields = $formatter->getData($driver, $formatter->getDefaults('collection-recor <? /* Table summary not supported in html 5, finc-specific solution, CK */ ?> <caption class="sr-only"><?=$this->transEsc('Bibliographic Details')?></caption> <? foreach ($fields as $key => $current): ?> - <tr><th><?=$this->transEsc($key)?>:</th><td><?=$current['value']?></td></tr> + <? if ($key == null): ?> + <?=$current['value']?> + <? else: ?> + <tr><th><?=$this->transEsc($key)?>:</th><td><?=$current['value']?></td></tr> + <? endif; ?> <? endforeach; ?> </table> <? endif; ?>