Skip to content

Commit 5498422

Browse files
[BUGFIX] Restore merging of arrays for physical nodes (kitodo#1467)
1 parent fa04408 commit 5498422

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Classes/Common/MetsDocument.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,8 +1407,8 @@ protected function magicGetPhysicalStructure(): array
14071407
// Get file groups.
14081408
$fileUse = $this->magicGetFileGrps();
14091409
// Get the physical sequence's metadata.
1410-
$physNode = $this->mets->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]');
1411-
$firstNode = $physNode[0];
1410+
$physicalNodes = $this->mets->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]');
1411+
$firstNode = $physicalNodes[0];
14121412
$id = (string) $firstNode['ID'];
14131413
$this->physicalStructureInfo[$id]['id'] = $id;
14141414
$this->physicalStructureInfo[$id]['dmdId'] = $this->getAttribute($firstNode['DMDID']);
@@ -1421,7 +1421,7 @@ protected function magicGetPhysicalStructure(): array
14211421

14221422
$this->getFileRepresentation($id, $firstNode);
14231423

1424-
$this->physicalStructure = $this->getPhysicalElements($elementNodes, $fileUse);
1424+
$this->physicalStructure = array_merge([$id], $this->getPhysicalElements($elementNodes, $fileUse));
14251425
}
14261426
$this->physicalStructureLoaded = true;
14271427

@@ -1518,8 +1518,6 @@ private function getPhysicalElements(array $elementNodes, array $fileUse): array
15181518
ksort($elements);
15191519
// Set total number of pages/tracks.
15201520
$this->numPages = count($elements);
1521-
// Merge and re-index the array to get numeric indexes.
1522-
array_unshift($elements, $id);
15231521

15241522
return $elements;
15251523
}

0 commit comments

Comments
 (0)