Skip to content

Commit

Permalink
Fix errors caused by missing keys in entry array
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrycze-volk committed Sep 24, 2024
1 parent c5d13ea commit 7d5f515
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Classes/Controller/TableOfContentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private function getMenuEntry(array $entry, bool $recursive = false): array
$entryArray['doNotLinkIt'] = 1;
$entryArray['ITEM_STATE'] = 'NO';

$this->buildMenuLinks($entryArray, $entry['id'], $entry['points'], $entry['targetUid']);
$this->buildMenuLinks($entryArray, $entry['id'], $entry['points'] ?? null, $entry['targetUid'] ?? null);

// Set "ITEM_STATE" to "CUR" if this entry points to current page.
if (in_array($entry['id'], $this->activeEntries)) {
Expand All @@ -148,7 +148,7 @@ private function getMenuEntry(array $entry, bool $recursive = false): array
// 3. Current menu node has no corresponding images
if (
$entryArray['ITEM_STATE'] == 'CUR'
|| is_string($entry['points'])
|| (array_key_exists('points', $entry) && is_string($entry['points']))
|| empty($this->document->getCurrentDocument()->smLinks['l2p'][$entry['id']])
) {
$entryArray['_SUB_MENU'] = [];
Expand Down Expand Up @@ -241,7 +241,7 @@ private function resolveMenuEntry(array $entry): array
$doc = $this->document->getCurrentDocument();
if (
$doc instanceof MetsDocument
&& ($entry['points'] === $doc->parentHref || $this->isMultiElement($entry['type']))
&& ((array_key_exists('points', $entry) && $entry['points'] === $doc->parentHref) || $this->isMultiElement($entry['type']))
&& !empty($this->document->getPartof())
) {
unset($entry['points']);
Expand Down

0 comments on commit 7d5f515

Please sign in to comment.