|
14 | 14 | use Kitodo\Dlf\Common\Helper; |
15 | 15 | use Kitodo\Dlf\Common\MetsDocument; |
16 | 16 | use Psr\Http\Message\ResponseInterface; |
| 17 | +use TYPO3\CMS\Core\Utility\GeneralUtility; |
17 | 18 | use TYPO3\CMS\Core\Utility\MathUtility; |
18 | 19 |
|
19 | 20 | /** |
@@ -252,13 +253,18 @@ private function resolveMenuEntry(array $entry): array |
252 | 253 | // If the menu entry points to the parent document, |
253 | 254 | // resolve to the parent UID set on indexation. |
254 | 255 | $doc = $this->document->getCurrentDocument(); |
255 | | - if ( |
256 | | - $doc instanceof MetsDocument |
257 | | - && ((array_key_exists('points', $entry) && $entry['points'] === $doc->parentHref) || $this->isMultiElement($entry['type'])) |
258 | | - && !empty($this->document->getPartof()) |
259 | | - ) { |
260 | | - unset($entry['points']); |
261 | | - $entry['targetUid'] = $this->document->getPartof(); |
| 256 | + if ($doc instanceof MetsDocument && array_key_exists('points', $entry)) { |
| 257 | + if ($entry['points'] === $doc->parentHref || $this->isMultiElement($entry['type']) && !empty($this->document->getPartof())) { |
| 258 | + unset($entry['points']); |
| 259 | + $entry['targetUid'] = $this->document->getPartof(); |
| 260 | + } elseif (GeneralUtility::isValidUrl((string) $entry['points'])) { |
| 261 | + // this case is for the newspaper issues pointing to the newspaper METS file (2 levels up) |
| 262 | + $document = $this->documentRepository->findOneBy(['location' => $entry['points']]); |
| 263 | + if ($document !== null) { |
| 264 | + unset($entry['points']); |
| 265 | + $entry['targetUid'] = $document->getUid(); |
| 266 | + } |
| 267 | + } |
262 | 268 | } |
263 | 269 |
|
264 | 270 | return $entry; |
|
0 commit comments