Skip to content

Commit

Permalink
Update CreateModuleWithExtbase.rst (#5138)
Browse files Browse the repository at this point in the history
Extend the code example how to create links to Extbase controller actions. It is not obvious based on the current documentation, that the array-key of the new module-configuration must be used, plus passing the controller and action name as arguments.

The issue was solved in Slack (thanks Garvin!) and is now added here for future use.
  • Loading branch information
Moongazer authored Dec 11, 2024
1 parent 65c156d commit 758d8fd
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,15 @@ After that you can add titles, menus and buttons using :php:`ModuleTemplate`:
{
$this->view->assign('someVar', 'someContent');
$moduleTemplate = $this->moduleTemplateFactory->create($this->request);
// Adding title, menus, buttons, etc. using $moduleTemplate ...
// Example of adding a page-shortcut button
$routeIdentifier = 'web_examples'; // array-key of the module-configuration
$buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar();
$shortcutButton = $buttonBar->makeShortcutButton()->setDisplayName('Shortcut to my action')->setRouteIdentifier($routeIdentifier);
$shortcutButton->setArguments(['controller' => 'MyController', 'action' => 'my']);
$buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT);
// Adding title, menus and more buttons using $moduleTemplate ...
$moduleTemplate->setContent($this->view->render());
return $this->htmlResponse($moduleTemplate->renderContent());
}
Expand Down

0 comments on commit 758d8fd

Please sign in to comment.