|
26 | 26 | use T3docs\BlogExample\Domain\Repository\PostRepository; |
27 | 27 | use T3docs\BlogExample\Service\BlogFactory; |
28 | 28 | use TYPO3\CMS\Backend\Template\Components\ButtonBar; |
| 29 | +use TYPO3\CMS\Backend\Template\Components\ComponentFactory; |
29 | 30 | use TYPO3\CMS\Backend\Template\Components\Menu\Menu; |
30 | 31 | use TYPO3\CMS\Backend\Template\ModuleTemplate; |
31 | 32 | use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; |
@@ -58,6 +59,7 @@ public function __construct( |
58 | 59 | protected readonly ModuleTemplateFactory $moduleTemplateFactory, |
59 | 60 | private readonly IconFactory $iconFactory, |
60 | 61 | private readonly LanguageServiceFactory $languageServiceFactory, |
| 62 | + protected readonly ComponentFactory $componentFactory, |
61 | 63 | ) {} |
62 | 64 |
|
63 | 65 | public function addPopulateButton(ButtonBar $buttonBar): void |
@@ -265,17 +267,21 @@ private function buildMenu(ModuleTemplate $view, string &$context): Menu |
265 | 267 | 'index' => [ |
266 | 268 | 'controller' => 'Backend', |
267 | 269 | 'action' => 'index', |
268 | | - 'label' => $this->getLanguageService()->sL('blog_example.messages:administration.menu.index'), |
| 270 | + 'label' => $this->getLanguageService()->translate('administration.menu.index', 'blog_example.messages') ?? 'abc', |
269 | 271 | ], |
270 | 272 | 'showAllComents' => [ |
271 | 273 | 'controller' => 'Backend', |
272 | 274 | 'action' => 'showAllComments', |
273 | | - 'label' => $this->getLanguageService()->sL('blog_example.messages:administration.menu.comments'), |
| 275 | + 'label' => $this->getLanguageService()->translate('administration.menu.comments', 'blog_example.messages') ?? 'abc', |
274 | 276 | ], |
275 | 277 | ]; |
276 | 278 |
|
| 279 | + $menuRegistry = $view->getDocHeaderComponent()->getMenuRegistry(); |
| 280 | + //$menu = $this->componentFactory->createMenu(); |
| 281 | + //$menu->setIdentifier('viewSelector')->setLabel('View'); |
| 282 | + |
277 | 283 | $menu = $view->getDocHeaderComponent()->getMenuRegistry()->makeMenu(); |
278 | | - $menu->setIdentifier('BlogExampleModuleMenu'); |
| 284 | + $menu->setIdentifier('BlogExampleModuleMenu')->setLabel('View'); |
279 | 285 |
|
280 | 286 | foreach ($menuItems as $menuItemConfig) { |
281 | 287 | $isActive = $this->request->getControllerActionName() === $menuItemConfig['action']; |
|
0 commit comments