Skip to content

Commit

Permalink
[UPGRADE] Render Response in ModuleTemplates render method
Browse files Browse the repository at this point in the history
  • Loading branch information
tinzog committed Jan 16, 2025
1 parent 2ce2989 commit 8f61527
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 10 additions & 3 deletions Classes/Controller/Traits/ControllerModuleTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
use TYPO3\CMS\Core\Http\JsonResponse;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Request;
use TYPO3\CMS\Extbase\Mvc\RequestInterface;
Expand Down Expand Up @@ -63,7 +64,13 @@ public function processRequest(RequestInterface $request): ResponseInterface
return parent::processRequest($request);
}

protected function render(): string
protected function htmlResponse(string $html = null): ResponseInterface
{
return $this->render();
}


protected function render(): ResponseInterface
{
$docHeader = $this->moduleTemplate->getDocHeaderComponent();
$buttonBar = $docHeader->getButtonBar();
Expand All @@ -79,6 +86,6 @@ protected function render(): string
);
$this->eventDispatcher->dispatch($event);

return $this->moduleTemplate->render();
return $this->moduleTemplate->renderResponse($this->request->getControllerName() . '/' . ucfirst($this->request->getControllerActionName()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use In2code\In2publishCore\Controller\Traits\ControllerModuleTemplate;
use In2code\In2publishCore\Features\AdminTools\Backend\Button\AdminToolButton;
use In2code\In2publishCore\Features\AdminTools\Service\ToolsRegistry;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Request;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
Expand Down Expand Up @@ -60,7 +61,7 @@ public function injectToolsRegistry(ToolsRegistry $toolsRegistry): void
$this->toolsRegistry = $toolsRegistry;
}

protected function render(): string
protected function render(): ResponseInterface
{
$this->moduleTemplate->setModuleClass('tx_in2publishcore_admintools');
$docHeader = $this->moduleTemplate->getDocHeaderComponent();
Expand Down

0 comments on commit 8f61527

Please sign in to comment.