From 111f68404fe3eedfe21e9430a009b268dc69ae02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20K=C3=A4hm?= Date: Tue, 24 Sep 2024 17:33:52 +0200 Subject: [PATCH] [BUGFIX] `@typo3/backend/tree/page-tree-element` does not work in BE-Modules This change fixes the strange behavior by switching BE-modules and/or page in page-tree. It depends on following TYPO3 core issues: * https://forge.typo3.org/issues/103784 * https://forge.typo3.org/issues/104457 Fixes: #4165 Relates: #3995 --- .../Backend/Search/AbstractModuleController.php | 11 +++++------ .../Backend/Search/IndexQueueModuleController.php | 1 - .../Backend/Search/InfoModuleController.php | 7 +++---- Resources/Private/Layouts/Backend/WithPageTree.html | 7 +++++-- .../Backend/Search/IndexQueueModule/Index.html | 2 +- .../Templates/Backend/Search/InfoModule/Index.html | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Classes/Controller/Backend/Search/AbstractModuleController.php b/Classes/Controller/Backend/Search/AbstractModuleController.php index b8029911e6..bd7844f0e3 100644 --- a/Classes/Controller/Backend/Search/AbstractModuleController.php +++ b/Classes/Controller/Backend/Search/AbstractModuleController.php @@ -34,10 +34,11 @@ use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; +use TYPO3\CMS\Core\View\ViewInterface; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; -use TYPO3Fluid\Fluid\View\ViewInterface; +use TYPO3Fluid\Fluid\View\ViewInterface as FluidStandaloneViewInterface; /** * Abstract Module @@ -142,16 +143,16 @@ protected function autoSelectFirstSiteAndRootPageWhenOnlyOneSiteIsAvailable(): b /** * Set up the doc header properly here * + * @throws InvalidArgumentException * @throws UnexpectedTYPO3SiteInitializationException - * @param ViewInterface $view */ - protected function initializeView($view): void + protected function initializeView(ViewInterface|FluidStandaloneViewInterface $view): void { $sites = $this->siteRepository->getAvailableSites(); $selectOtherPage = count($sites) > 0 || $this->selectedPageUID < 1; $this->moduleTemplate->assign('showSelectOtherPage', $selectOtherPage); - $this->moduleTemplate->assign('pageUID', $this->selectedPageUID); + $this->moduleTemplate->assign('selectedPageUID', $this->selectedPageUID); if ($this->selectedPageUID < 1) { return; } @@ -222,8 +223,6 @@ protected function generateCoreSelectorMenu(Site $site, string $uriToRedirectTo /** * Empties the Index Queue * - * @throws DBALException - * * @noinspection PhpUnused Used in IndexQueue- and IndexAdministration- controllers */ public function clearIndexQueueAction(): ResponseInterface diff --git a/Classes/Controller/Backend/Search/IndexQueueModuleController.php b/Classes/Controller/Backend/Search/IndexQueueModuleController.php index 3a1fa51076..c24e83aee5 100644 --- a/Classes/Controller/Backend/Search/IndexQueueModuleController.php +++ b/Classes/Controller/Backend/Search/IndexQueueModuleController.php @@ -65,7 +65,6 @@ public function setIndexQueue(QueueInterface $indexQueue): void */ public function indexAction(): ResponseInterface { - $this->initializeAction(); if (!$this->canQueueSelectedSite()) { $this->moduleTemplate->assign('can_not_proceed', true); return $this->moduleTemplate->renderResponse('Backend/Search/IndexQueueModule/Index'); diff --git a/Classes/Controller/Backend/Search/InfoModuleController.php b/Classes/Controller/Backend/Search/InfoModuleController.php index 6905d3c184..58c58bb1d9 100644 --- a/Classes/Controller/Backend/Search/InfoModuleController.php +++ b/Classes/Controller/Backend/Search/InfoModuleController.php @@ -53,7 +53,6 @@ protected function initializeAction(): void */ public function indexAction(): ResponseInterface { - $this->initializeAction(); if ($this->selectedSite === null) { $this->moduleTemplate->assign('can_not_proceed', true); return $this->moduleTemplate->renderResponse('Backend/Search/InfoModule/Index'); @@ -73,9 +72,9 @@ public function indexAction(): ResponseInterface * @noinspection PhpUnused * @throws DBALException */ - public function documentsDetailsAction(string $type, int $uid, int $pageId, int $languageUid): ResponseInterface + public function documentsDetailsAction(string $type, int $uid, int $selectedPageUID, int $languageUid): ResponseInterface { - $documents = $this->apacheSolrDocumentRepository->findByTypeAndPidAndUidAndLanguageId($type, $uid, $pageId, $languageUid); + $documents = $this->apacheSolrDocumentRepository->findByTypeAndPidAndUidAndLanguageId($type, $uid, $selectedPageUID, $languageUid); $this->moduleTemplate->assign('documents', $documents); return $this->moduleTemplate->renderResponse('Backend/Search/InfoModule/DocumentsDetails'); } @@ -274,7 +273,7 @@ protected function collectIndexInspectorInfo(): void } $this->moduleTemplate->assignMultiple([ - 'pageId' => $this->selectedPageUID, + 'selectedPageUID' => $this->selectedPageUID, 'indexInspectorDocumentsByLanguageAndType' => $documentsByCoreAndType, ]); } diff --git a/Resources/Private/Layouts/Backend/WithPageTree.html b/Resources/Private/Layouts/Backend/WithPageTree.html index 5c58482b08..1ef682ddee 100644 --- a/Resources/Private/Layouts/Backend/WithPageTree.html +++ b/Resources/Private/Layouts/Backend/WithPageTree.html @@ -29,8 +29,11 @@ - - + + diff --git a/Resources/Private/Templates/Backend/Search/IndexQueueModule/Index.html b/Resources/Private/Templates/Backend/Search/IndexQueueModule/Index.html index 4f96fd7c7c..ea25acedae 100644 --- a/Resources/Private/Templates/Backend/Search/IndexQueueModule/Index.html +++ b/Resources/Private/Templates/Backend/Search/IndexQueueModule/Index.html @@ -129,7 +129,7 @@

- + diff --git a/Resources/Private/Templates/Backend/Search/InfoModule/Index.html b/Resources/Private/Templates/Backend/Search/InfoModule/Index.html index 2a62b155a4..b6c0d3538c 100644 --- a/Resources/Private/Templates/Backend/Search/InfoModule/Index.html +++ b/Resources/Private/Templates/Backend/Search/InfoModule/Index.html @@ -306,7 +306,7 @@

- +