From 04d32793fc4b291fb407696b63568b9619e83fd9 Mon Sep 17 00:00:00 2001 From: Hanns <1685510+moongazer@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:03:48 +0100 Subject: [PATCH] Update CreateModuleWithExtbase.rst (#5138) 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. --- .../HowTo/BackendModule/CreateModuleWithExtbase.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/ExtensionArchitecture/HowTo/BackendModule/CreateModuleWithExtbase.rst b/Documentation/ExtensionArchitecture/HowTo/BackendModule/CreateModuleWithExtbase.rst index fe2dcb8c9..b4d96d188 100644 --- a/Documentation/ExtensionArchitecture/HowTo/BackendModule/CreateModuleWithExtbase.rst +++ b/Documentation/ExtensionArchitecture/HowTo/BackendModule/CreateModuleWithExtbase.rst @@ -61,7 +61,16 @@ 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 $moduleTemplate->renderResponse('MyController/MyAction'); }