Skip to content

Commit

Permalink
Update CreateModuleWithExtbase.rst (#5138) (#5141)
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.

Co-authored-by: Hanns <[email protected]>
  • Loading branch information
github-actions[bot] and Moongazer authored Dec 11, 2024
1 parent 94fb6e1 commit fcd5ce7
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit fcd5ce7

Please sign in to comment.