Skip to content

Commit

Permalink
[BUGFIX] Use SimplifiedExtbackendModuleTemplateAPI in ControllerModul…
Browse files Browse the repository at this point in the history
  • Loading branch information
tinzog committed Jan 13, 2025
1 parent 466df2e commit c46ef5f
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions Classes/Controller/Traits/ControllerModuleTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,7 @@ public function processRequest(RequestInterface $request): ResponseInterface
return parent::processRequest($request);
}

protected function htmlResponse(string $html = null): ResponseInterface
{
return $this->responseFactory->createResponse()
->withHeader('Content-Type', 'text/html; charset=utf-8')
->withBody($this->streamFactory->createStream($html ?? $this->render()));
}

protected function jsonResponse(string $json = null): ResponseInterface
{
return $this->responseFactory
->createResponse()
->withHeader('Content-Type', 'application/json; charset=utf-8')
->withBody($this->streamFactory->createStream($json ?? $this->render()));
}

protected function render(): string
protected function render(): ResponseInterface
{
$docHeader = $this->moduleTemplate->getDocHeaderComponent();
$buttonBar = $docHeader->getButtonBar();
Expand All @@ -87,15 +72,13 @@ protected function render(): string
$moduleShortcutButton->setRequest($this->request);
$buttonBar->addButton($moduleShortcutButton);

$this->moduleTemplate->setContent($this->view->render());

$event = new ModuleTemplateWasPreparedForRendering(
$this->moduleTemplate,
static::class,
$this->actionMethodName
);
$this->eventDispatcher->dispatch($event);

return $this->moduleTemplate->renderContent();
return $this->moduleTemplate->renderResponse();
}
}

0 comments on commit c46ef5f

Please sign in to comment.