Skip to content

Commit

Permalink
[TASK] Add labels to docheader action-menu dropdown
Browse files Browse the repository at this point in the history
This patch adds a label to the action-menu used by most of
the core extensions.

Resolves: #102548
Releases: main, 12.4
Change-Id: I57db0e4d35b439e8841d7f4281bc09b593bb9dc4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82008
Reviewed-by: Andreas Kienast <a.fernandez@scripting-base.de>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benjamin Kott <benjamin.kott@outlook.com>
Reviewed-by: Benjamin Kott <benjamin.kott@outlook.com>
Tested-by: Andreas Kienast <a.fernandez@scripting-base.de>
  • Loading branch information
whmyr authored and andreaskienast committed Mar 15, 2024
1 parent 5c95229 commit bc6a791
Show file tree
Hide file tree
Showing 17 changed files with 97 additions and 11 deletions.
Expand Up @@ -1972,6 +1972,11 @@ protected function languageSwitch(ModuleTemplate $view, string $table, int $uid,
}
$languageMenu = $view->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$languageMenu->setIdentifier('_langSelector');
$languageMenu->setLabel(
$this->getLanguageService()->sL(
'LLL:EXT:backend/Resources/Private/Language/locallang.xlf:editdocument.moduleMenu.dropdown.label'
)
);
foreach ($availableLanguages as $languageId => $language) {
$selectorOptionLabel = $language['title'];
// Create url for creating a localized record
Expand Down
Expand Up @@ -287,7 +287,11 @@ protected function makeActionMenu(ModuleTemplate $view, array $tsConfig): void

$actionMenu = $view->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$actionMenu->setIdentifier('actionMenu');
$actionMenu->setLabel('');
$actionMenu->setLabel(
$languageService->sL(
'LLL:EXT:backend/Resources/Private/Language/locallang.xlf:pagelayout.moduleMenu.dropdown.label'
)
);
$defaultKey = null;
$foundDefaultKey = false;
foreach ($actions as $key => $action) {
Expand Down
6 changes: 6 additions & 0 deletions typo3/sysext/backend/Classes/Template/ModuleTemplate.php
Expand Up @@ -277,6 +277,12 @@ public function makeDocHeaderModuleMenu(array $additionalQueryParams = []): self
}
$menu = $this->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$menu->setIdentifier('moduleMenu');
$menu->setLabel(
$this->getLanguageService()->sL(
'LLL:EXT:backend/Resources/Private/Language/locallang.xlf:moduleMenu.dropdown.label'
)
);

foreach ($menuModule->getSubModules() as $module) {
$item = $menu
->makeMenuItem()
Expand Down
9 changes: 9 additions & 0 deletions typo3/sysext/backend/Resources/Private/Language/locallang.xlf
Expand Up @@ -190,6 +190,15 @@ Have a nice day.</source>
<trans-unit id="liveSearch.pageRecordProvider.typeLabel" resname="liveSearch.pageRecordProvider.typeLabel">
<source>Page</source>
</trans-unit>
<trans-unit id="moduleMenu.dropdown.label" resname="moduleMenu.dropdown.label">
<source>Module action</source>
</trans-unit>
<trans-unit id="pagelayout.moduleMenu.dropdown.label" resname="pagelayout.moduleMenu.dropdown.label">
<source>Display mode</source>
</trans-unit>
<trans-unit id="editdocument.moduleMenu.dropdown.label" resname="editdocument.moduleMenu.dropdown.label">
<source>Record language</source>
</trans-unit>
</body>
</file>
</xliff>
@@ -1,8 +1,13 @@
<f:if condition="{menu.menuItems -> f:count()} > 1">
{menu.label} <select class="form-select form-select-sm t3-js-jumpMenuBox"
name="{menu.identifier}"
data-menu-identifier="{menu.dataIdentifier}"
data-global-event="change" data-action-navigate="$value">
<f:if condition="{menu.label}">
<label class="form-label visually-hidden" for="{menu.identifier}">{menu.label}</label>
</f:if>
<select class="form-select form-select-sm t3-js-jumpMenuBox"
name="{menu.identifier}"
id="{menu.identifier}"
data-menu-identifier="{menu.dataIdentifier}"
data-global-event="change" data-action-navigate="$value"
>
<f:for each="{menu.menuItems}" as="menuItem">
<option value="{menuItem.href}" {f:if(condition: '{menuItem.active}', then: ' selected="selected"')}>{menuItem.title}</option>
</f:for>
Expand Down
Expand Up @@ -546,6 +546,12 @@ protected function addMainMenu(string $currentAction): void
$this->uriBuilder->setRequest($this->request);
$menu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$menu->setIdentifier('BackendUserModuleMenu');
$menu->setLabel(
LocalizationUtility::translate(
'LLL:EXT:backend/Resources/Private/Language/locallang.xlf:modulemenu.label',
'backend',
)
);
$menu->addMenuItem(
$menu->makeMenuItem()
->setTitle(LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:backendUsers', 'beuser'))
Expand Down
Expand Up @@ -118,6 +118,11 @@ protected function initializeModuleTemplate(RequestInterface $request): ModuleTe
]);
$menu = $view->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$menu->setIdentifier('ExtensionManagerModuleMenu');
$menu->setLabel(
$this->translate(
'LLL:EXT:backend/Resources/Private/Language/locallang.xlf:moduleMenu.dropdown.label'
)
);

foreach ($menuItems as $menuItemConfig) {
if ($request->getControllerName() === $menuItemConfig['controller']) {
Expand Down
Expand Up @@ -61,33 +61,39 @@ public function __construct(
*/
protected function initializeModuleTemplate(ServerRequestInterface $request): ModuleTemplate
{
$languageService = $this->getLanguageService();
$menuItems = [
'statistic' => [
'controller' => 'Administration',
'action' => 'statistic',
'label' => $this->getLanguageService()->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang.xlf:administration.menu.statistic'),
'label' => $languageService->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang.xlf:administration.menu.statistic'),
],
'pages' => [
'controller' => 'Administration',
'action' => 'pages',
'label' => $this->getLanguageService()->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang.xlf:administration.menu.pages'),
'label' => $languageService->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang.xlf:administration.menu.pages'),
],
'externalDocuments' => [
'controller' => 'Administration',
'action' => 'externalDocuments',
'label' => $this->getLanguageService()->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang.xlf:administration.menu.externalDocuments'),
'label' => $languageService->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang.xlf:administration.menu.externalDocuments'),
],
'index' => [
'controller' => 'Administration',
'action' => 'index',
'label' => $this->getLanguageService()->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang.xlf:administration.menu.general'),
'label' => $languageService->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang.xlf:administration.menu.general'),
],
];

$view = $this->moduleTemplateFactory->create($request);

$menu = $view->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$menu->setIdentifier('IndexedSearchModuleMenu');
$menu->setLabel(
$languageService->sL(
'LLL:EXT:backend/Resources/Private/Language/locallang.xlf:moduleMenu.dropdown.label'
)
);

$context = '';
foreach ($menuItems as $menuItemConfig) {
Expand All @@ -104,7 +110,7 @@ protected function initializeModuleTemplate(ServerRequestInterface $request): Mo

$view->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
$view->setTitle(
$this->getLanguageService()->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang_mod.xlf:mlang_tabs_tab'),
$languageService->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang_mod.xlf:mlang_tabs_tab'),
$context
);

Expand Down
Expand Up @@ -462,6 +462,11 @@ protected function addDocHeaderDropDown(ModuleTemplate $view, string $currentAct
$languageService = $this->getLanguageService();
$actionMenu = $view->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$actionMenu->setIdentifier('reportLinkvalidatorSelector');
$actionMenu->setLabel(
$languageService->sL(
'LLL:EXT:backend/Resources/Private/Language/locallang.xlf:moduleMenu.dropdown.label'
)
);
$actionMenu->addMenuItem(
$actionMenu->makeMenuItem()
->setTitle($languageService->sL('LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:Report'))
Expand Down
Expand Up @@ -141,6 +141,11 @@ private function addProviderDropDownToDocHeader(ModuleTemplate $view, array $pro
{
$menu = $view->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$menu->setIdentifier('tree');
$menu->setLabel(
$this->getLanguageService()->sL(
'LLL:EXT:lowlevel/Resources/Private/Language/locallang.xlf:moduleMenu.dropdown.label'
)
);
foreach ($providers as $provider) {
$menuItem = $menu->makeMenuItem()
->setHref((string)$this->uriBuilder->buildUriFromRoute('system_config', ['tree' => $provider->getIdentifier()]))
Expand Down
Expand Up @@ -371,6 +371,11 @@ protected function setUpDocHeader(ModuleTemplate $moduleTemplate): void

$menu = $moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$menu->setIdentifier('DatabaseJumpMenu');
$menu->setLabel(
$this->getLanguageService()->sL(
'LLL:EXT:lowlevel/Resources/Private/Language/locallang.xlf:module.dbint.docheader.viewmode'
)
);
foreach ($this->MOD_MENU['function'] as $controller => $title) {
$item = $menu
->makeMenuItem()
Expand Down
Expand Up @@ -16,6 +16,9 @@
<source>%s search match(es)</source>
</trans-unit>

<trans-unit id="moduleMenu.dropdown.label" resname="moduleMenu.dropdown.label">
<source>Configuration to show</source>
</trans-unit>
<trans-unit id="typo3ConfVars" resname="typo3ConfVars">
<source>$GLOBALS['TYPO3_CONF_VARS'] (Global Configuration)</source>
</trans-unit>
Expand Down Expand Up @@ -86,6 +89,10 @@
<trans-unit id="module.dbint.description" resname="module.dbint.description">
<source>Here you can check the integrity of the database tables configured by the $TCA. For instance all records must belong to a page record. You can also get a view of the total pagetree including deleted pages. Finally you've got access to a global database search facility.&lt;br /&gt;&lt;em&gt;Access for 'admin' users only!&lt;/em&gt;</source>
</trans-unit>

<trans-unit id="module.dbint.docheader.viewmode" resname="module.dbint.docheader.viewmode">
<source>Module action</source>
</trans-unit>
<trans-unit id="search.placeholder" resname="search.placeholder">
<source>Search Word</source>
<note>Placeholder text for search in database input</note>
Expand Down
3 changes: 3 additions & 0 deletions typo3/sysext/reports/Classes/Controller/ReportController.php
Expand Up @@ -138,6 +138,9 @@ protected function addMainMenu(ModuleTemplate $view, string $activeReportIdentif
$languageService = $this->getLanguageService();
$menu = $view->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$menu->setIdentifier('WebFuncJumpMenu');
$menu->setLabel(
$languageService->sL('LLL:EXT:reports/Resources/Private/Language/locallang.xlf:choose_report')
);
$menuItem = $menu->makeMenuItem()
->setHref(
(string)$this->uriBuilder->buildUriFromRoute('system_reports', ['action' => 'index'])
Expand Down
Expand Up @@ -140,6 +140,11 @@ protected function registerDocHeader(ModuleTemplate $view, int $pageId, int $lan
if (count($languages) > 1) {
$languageMenu = $view->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$languageMenu->setIdentifier('_langSelector');
$languageMenu->setLabel(
$languageService->sL(
'LLL:EXT:viewpage/Resources/Private/Language/locallang.xlf:moduleMenu.dropdown.label'
)
);
foreach ($languages as $value => $label) {
$href = (string)$this->uriBuilder->buildUriFromRoute(
'page_preview',
Expand Down
Expand Up @@ -51,6 +51,9 @@
<trans-unit id="iframe.title" resname="iframe.title">
<source>View selected page in different screen resolutions</source>
</trans-unit>
<trans-unit id="moduleMenu.dropdown.label" resname="moduleMenu.dropdown.label">
<source>Page language</source>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -165,7 +165,11 @@ protected function addWorkspaceSelector(ModuleTemplate $view, array $availableWo
}
$actionMenu = $view->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$actionMenu->setIdentifier('workspaceSelector');
$actionMenu->setLabel('');
$actionMenu->setLabel(
$this->getLanguageService()->sL(
'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:moduleMenu.dropdown.label'
)
);
foreach ($items as $workspaceData) {
$menuItem = $actionMenu
->makeMenuItem()
Expand Down
Expand Up @@ -393,6 +393,9 @@
<trans-unit id="status.is_new" resname="status.is_new">
<source>Record was created in this workspace</source>
</trans-unit>
<trans-unit id="moduleMenu.dropdown.label" resname="moduleMenu.dropdown.label">
<source>Selected workspace</source>
</trans-unit>
</body>
</file>
</xliff>

0 comments on commit bc6a791

Please sign in to comment.