Skip to content

Commit

Permalink
Update CreateModuleWithExtbase.rst - rendering example is broken (#5150)
Browse files Browse the repository at this point in the history
ModuleTemplate->setContent() does not exist.
It comes with its own view.
  • Loading branch information
masi authored and linawolf committed Dec 24, 2024
1 parent bfc9412 commit d78f45d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ After that you can add titles, menus and buttons using :php:`ModuleTemplate`:
// use Psr\Http\Message\ResponseInterface
public function myAction(): ResponseInterface
{
$this->view->assign('someVar', 'someContent');
$moduleTemplate = $this->moduleTemplateFactory->create($this->request);
// Example of assignung variables to the view
$moduleTemplate->assign('someVar', 'someContent');
// Example of adding a page-shortcut button
$routeIdentifier = 'web_examples'; // array-key of the module-configuration
$buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar();
Expand All @@ -70,7 +72,6 @@ After that you can add titles, menus and buttons using :php:`ModuleTemplate`:
$buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT);
// Adding title, menus and more buttons using $moduleTemplate ...
$moduleTemplate->setContent($this->view->render());
return $moduleTemplate->renderResponse('MyController/MyAction');
}
Expand Down

0 comments on commit d78f45d

Please sign in to comment.