From fcd5ce7ae626158ac8fac3973aff8b691f84df93 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:10:09 +0100 Subject: [PATCH] Update CreateModuleWithExtbase.rst (#5138) (#5141) 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. Co-authored-by: Hanns <1685510+moongazer@users.noreply.github.com> --- .../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 13b968690..6075aa7dd 100644 --- a/Documentation/ExtensionArchitecture/HowTo/BackendModule/CreateModuleWithExtbase.rst +++ b/Documentation/ExtensionArchitecture/HowTo/BackendModule/CreateModuleWithExtbase.rst @@ -57,7 +57,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'); }