Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] @typo3/backend/tree/page-tree-element does not work in BE-Modules #4167

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Classes/Controller/Backend/Search/AbstractModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
7 changes: 3 additions & 4 deletions Classes/Controller/Backend/Search/InfoModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
}
Expand Down Expand Up @@ -274,7 +273,7 @@ protected function collectIndexInspectorInfo(): void
}

$this->moduleTemplate->assignMultiple([
'pageId' => $this->selectedPageUID,
'selectedPageUID' => $this->selectedPageUID,
'indexInspectorDocumentsByLanguageAndType' => $documentsByCoreAndType,
]);
}
Expand Down
7 changes: 5 additions & 2 deletions Resources/Private/Layouts/Backend/WithPageTree.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
<f:render partial="Backend/NoSiteAvailable" arguments="{_all}"/>
</f:then>
<f:else>
<f:variable name="args" value="{0: 'searchbackend', 1: pageUID}" />
<typo3-immediate-action action="TYPO3.Backend.Storage.ModuleStateStorage.update" args="{args -> f:format.json() -> f:format.htmlspecialchars()}"></typo3-immediate-action>
<f:variable name="immediateActionArgs" value="{0: 'searchbackend', 1: selectedPageUID}" />
<typo3-immediate-action
action="TYPO3.Backend.Storage.ModuleStateStorage.update"
args="{immediateActionArgs -> f:format.json() -> f:format.htmlspecialchars()}"
></typo3-immediate-action>

<f:render partial="Backend/FlashMessages" />
<f:render section="Main"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ <h2>
<div class="row section-with-header">
<div class="col-md-3">

<f:form action="clearIndexQueue" additionalParams="{id: '{pageUID}'}">
<f:form action="clearIndexQueue" additionalParams="{id: '{selectedPageUID}'}">
<f:form.submit class="btn btn-sm btn-default btn-danger t3js-modal-formsubmit-trigger"
data="{title: 'Please confirm', content: 'Are you sure you want to clear the Index Queue?', severity: 'warning'}"
value="{f:translate(key:'solr.backend.index_queue_module.button.clear_index_queue')}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ <h3 class="panel-title">

<td>
<span class="btn btn-default">
<f:link.action action="documentsDetails" arguments="{uid: document.uid, type: document.type, languageUid: language, pageId: pageId}" title="Show details">
<f:link.action action="documentsDetails" arguments="{uid: document.uid, type: document.type, languageUid: language, selectedPageUID: selectedPageUID}" title="Show details">
<core:icon identifier="actions-document-view" />
</f:link.action>
</span>
Expand Down