[BUG] Multi-View not working correctly
Description
Class parameter documentArray is null if document is accessed by uid.
Reproduction
Steps to reproduce the behaviour:
- Install TYPO3 11.x with PHP 8.x
- Click on link to display document page e.g. https://sachsendigital.ddev.site
- See error
Expected Behavior
The documentArray parameter should be assigned for each type of document, not only ones accessed by URL.
Screenshots and Examples
Environment
- RDBMS version: MariaDB 10.3
- TYPO3 version: 11.5.37
- PHP version: 8.2
Additional Context
The function getDocumentByUid is not adjusted:
private function getDocumentByUid(int $documentId)
{
$doc = null;
$this->document = $this->documentRepository->findOneByIdAndSettings($documentId);
if ($this->document) {
$doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true);
} else {
$this->logger->error('Invalid UID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading');
}
return $doc;
}
The function getDocumentByUrl has necessary adjustments:
protected function getDocumentByUrl(string $documentId)
{
$doc = AbstractDocument::getInstance($documentId, $this->settings, true);
if (isset($this->settings['multiViewType']) && $doc->tableOfContents[0]['type'] === $this->settings['multiViewType']) {
$childDocuments = $doc->tableOfContents[0]['children'];
$i = 0;
foreach ($childDocuments as $document) {
$this->documentArray[] = AbstractDocument::getInstance($document['points'], $this->settings, true);
if (!isset($this->requestData['docPage'][$i]) && isset(explode('#', $document['points'])[1])) {
$initPage = explode('#', $document['points'])[1];
$this->requestData['docPage'][$i] = $initPage;
}
$i++;
}
} else {
$this->documentArray[] = $doc;
}
.....
return $doc;
}
Re-opening this, because #1345 was only a temporary fix. Multi-View still isn't completely implemented!
See also comments in https://github.com/kitodo/kitodo-presentation/blob/c014e8f3cf5e61f72d4f1363ed9faa0c23ac8709/Classes/Controller/AbstractController.php#L517-L541
Multi-view seems to be working in general, but there are still some bugs: #1487, #1488, #1489, #1490.
// TODO: implement multiView as it is in getDocumentByUrl
Will be resolved with the pull request #1485 . The multi view functionality has been generalized and is now used in both getDocumentByUid and getDocumentByUrl functions.