Skip to content

Commit

Permalink
[BUGFIX] Resolve link to the parent if the parent is multivolume_work…
Browse files Browse the repository at this point in the history
… or multipart_manuscript (kitodo#985)

Co-authored-by: Sebastian Meyer <[email protected]>
  • Loading branch information
beatrycze-volk and sebastian-meyer authored Jul 20, 2023
1 parent e3d09d8 commit c5a9268
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions Classes/Controller/TableOfContentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ protected function resolveMenuEntry($entry)
$doc = $this->document->getDoc();
if (
$doc instanceof MetsDocument
&& $entry['points'] === $doc->parentHref
&& ($entry['points'] === $doc->parentHref || $this->isMultiElement($entry['type']))
&& !empty($this->document->getPartof())
) {
unset($entry['points']);
Expand All @@ -244,18 +244,40 @@ protected function resolveMenuEntry($entry)

/**
* Get translated type of entry.
*
* @param array $type
*
* @param string $type
*
* @return string
*/
private function getTranslatedType($type) {
return Helper::translate($type, 'tx_dlf_structures', $this->settings['storagePid']);
}

/**
* Check if element has type 'multivolume_work' or 'multipart_manuscript'.
* For Kitodo.Production prior to version 3.x, hierarchical child documents
* always come with their own METS file for their parent document, even
* if multiple documents in fact have the same parent. To make sure that all
* of them point to the same parent document in Kitodo.Presentation, we
* need some workaround here.
*
* @todo Should be removed when Kitodo.Production 2.x is no longer supported.
*
* @access private
*
* @param string $type
*
* @return bool
*/
private function isMultiElement($type) {
return $type === 'multivolume_work' || $type === 'multipart_manuscript';
}

/**
* Sort menu by orderlabel - currently implemented for newspaper.
*
*
* @param array &$menu
*
* @return void
*/
private function sortMenu(&$menu) {
Expand All @@ -268,6 +290,7 @@ private function sortMenu(&$menu) {
* Sort menu years of the newspaper by orderlabel.
*
* @param array &$menu
*
* @return void
*/
private function sortMenuForNewspapers(&$menu) {
Expand Down

0 comments on commit c5a9268

Please sign in to comment.