From bc6a791d728c6ffd759db7043a702a31e58dd6ef Mon Sep 17 00:00:00 2001
From: Willi Wehmeier <wwwehmeier@gmail.com>
Date: Wed, 29 Nov 2023 08:34:20 +0100
Subject: [PATCH] [TASK] Add labels to docheader action-menu dropdown

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>
---
 .../Controller/EditDocumentController.php        |  5 +++++
 .../Classes/Controller/PageLayoutController.php  |  6 +++++-
 .../backend/Classes/Template/ModuleTemplate.php  |  6 ++++++
 .../Resources/Private/Language/locallang.xlf     |  9 +++++++++
 .../Partials/Menus/SelectBoxJumpMenu.html        | 13 +++++++++----
 .../Classes/Controller/BackendUserController.php |  6 ++++++
 .../Classes/Controller/AbstractController.php    |  5 +++++
 .../Controller/AdministrationController.php      | 16 +++++++++++-----
 .../Controller/LinkValidatorController.php       |  5 +++++
 .../Controller/ConfigurationController.php       |  5 +++++
 .../Controller/DatabaseIntegrityController.php   |  5 +++++
 .../Resources/Private/Language/locallang.xlf     |  7 +++++++
 .../Classes/Controller/ReportController.php      |  3 +++
 .../Classes/Controller/ViewModuleController.php  |  5 +++++
 .../Resources/Private/Language/locallang.xlf     |  3 +++
 .../Classes/Controller/ReviewController.php      |  6 +++++-
 .../Resources/Private/Language/locallang.xlf     |  3 +++
 17 files changed, 97 insertions(+), 11 deletions(-)

diff --git a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
index 6f59a0771de7..ebe404f344f8 100644
--- a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
+++ b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
@@ -1972,6 +1972,11 @@ class EditDocumentController
                     }
                     $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
diff --git a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php
index 61142f8ac452..39a5f935b364 100644
--- a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php
+++ b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php
@@ -287,7 +287,11 @@ class PageLayoutController
 
         $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) {
diff --git a/typo3/sysext/backend/Classes/Template/ModuleTemplate.php b/typo3/sysext/backend/Classes/Template/ModuleTemplate.php
index 8a157939c3e3..3ac56c0acd8c 100644
--- a/typo3/sysext/backend/Classes/Template/ModuleTemplate.php
+++ b/typo3/sysext/backend/Classes/Template/ModuleTemplate.php
@@ -277,6 +277,12 @@ final class ModuleTemplate implements ViewInterface, ResponsableViewInterface
         }
         $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()
diff --git a/typo3/sysext/backend/Resources/Private/Language/locallang.xlf b/typo3/sysext/backend/Resources/Private/Language/locallang.xlf
index 8b68b15c4bc7..de99a6997fa6 100644
--- a/typo3/sysext/backend/Resources/Private/Language/locallang.xlf
+++ b/typo3/sysext/backend/Resources/Private/Language/locallang.xlf
@@ -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>
diff --git a/typo3/sysext/backend/Resources/Private/Partials/Menus/SelectBoxJumpMenu.html b/typo3/sysext/backend/Resources/Private/Partials/Menus/SelectBoxJumpMenu.html
index 04fe372e662c..daffdd06999e 100644
--- a/typo3/sysext/backend/Resources/Private/Partials/Menus/SelectBoxJumpMenu.html
+++ b/typo3/sysext/backend/Resources/Private/Partials/Menus/SelectBoxJumpMenu.html
@@ -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>
diff --git a/typo3/sysext/beuser/Classes/Controller/BackendUserController.php b/typo3/sysext/beuser/Classes/Controller/BackendUserController.php
index 1b4707db95cc..6e8bf9e98784 100644
--- a/typo3/sysext/beuser/Classes/Controller/BackendUserController.php
+++ b/typo3/sysext/beuser/Classes/Controller/BackendUserController.php
@@ -546,6 +546,12 @@ class BackendUserController extends ActionController
         $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'))
diff --git a/typo3/sysext/extensionmanager/Classes/Controller/AbstractController.php b/typo3/sysext/extensionmanager/Classes/Controller/AbstractController.php
index 7f45d83a10bc..72dfb189eec0 100644
--- a/typo3/sysext/extensionmanager/Classes/Controller/AbstractController.php
+++ b/typo3/sysext/extensionmanager/Classes/Controller/AbstractController.php
@@ -118,6 +118,11 @@ class AbstractController extends ActionController
         ]);
         $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']) {
diff --git a/typo3/sysext/indexed_search/Classes/Controller/AdministrationController.php b/typo3/sysext/indexed_search/Classes/Controller/AdministrationController.php
index 8d7f079d622a..324a0a8ea02e 100644
--- a/typo3/sysext/indexed_search/Classes/Controller/AdministrationController.php
+++ b/typo3/sysext/indexed_search/Classes/Controller/AdministrationController.php
@@ -61,26 +61,27 @@ class AdministrationController extends ActionController
      */
     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'),
             ],
         ];
 
@@ -88,6 +89,11 @@ class AdministrationController extends ActionController
 
         $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) {
@@ -104,7 +110,7 @@ class AdministrationController extends ActionController
 
         $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
         );
 
diff --git a/typo3/sysext/linkvalidator/Classes/Controller/LinkValidatorController.php b/typo3/sysext/linkvalidator/Classes/Controller/LinkValidatorController.php
index 9c7270172ea0..e970df84ab62 100644
--- a/typo3/sysext/linkvalidator/Classes/Controller/LinkValidatorController.php
+++ b/typo3/sysext/linkvalidator/Classes/Controller/LinkValidatorController.php
@@ -462,6 +462,11 @@ class LinkValidatorController
         $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'))
diff --git a/typo3/sysext/lowlevel/Classes/Controller/ConfigurationController.php b/typo3/sysext/lowlevel/Classes/Controller/ConfigurationController.php
index db43d7b6db00..f69cf42fa3cd 100644
--- a/typo3/sysext/lowlevel/Classes/Controller/ConfigurationController.php
+++ b/typo3/sysext/lowlevel/Classes/Controller/ConfigurationController.php
@@ -141,6 +141,11 @@ final class ConfigurationController
     {
         $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()]))
diff --git a/typo3/sysext/lowlevel/Classes/Controller/DatabaseIntegrityController.php b/typo3/sysext/lowlevel/Classes/Controller/DatabaseIntegrityController.php
index 1a27d832e98f..ace39d675a5c 100644
--- a/typo3/sysext/lowlevel/Classes/Controller/DatabaseIntegrityController.php
+++ b/typo3/sysext/lowlevel/Classes/Controller/DatabaseIntegrityController.php
@@ -371,6 +371,11 @@ class DatabaseIntegrityController
 
         $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()
diff --git a/typo3/sysext/lowlevel/Resources/Private/Language/locallang.xlf b/typo3/sysext/lowlevel/Resources/Private/Language/locallang.xlf
index 43b5210fb688..1f4680ec052f 100644
--- a/typo3/sysext/lowlevel/Resources/Private/Language/locallang.xlf
+++ b/typo3/sysext/lowlevel/Resources/Private/Language/locallang.xlf
@@ -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>
@@ -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>
diff --git a/typo3/sysext/reports/Classes/Controller/ReportController.php b/typo3/sysext/reports/Classes/Controller/ReportController.php
index a0d52fc638fc..8fc590ef410d 100644
--- a/typo3/sysext/reports/Classes/Controller/ReportController.php
+++ b/typo3/sysext/reports/Classes/Controller/ReportController.php
@@ -138,6 +138,9 @@ class ReportController
         $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'])
diff --git a/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php b/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php
index 9cbff3a5a927..9415f055c621 100644
--- a/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php
+++ b/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php
@@ -140,6 +140,11 @@ class ViewModuleController
         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',
diff --git a/typo3/sysext/viewpage/Resources/Private/Language/locallang.xlf b/typo3/sysext/viewpage/Resources/Private/Language/locallang.xlf
index 8f384ad521f8..609a9e438068 100644
--- a/typo3/sysext/viewpage/Resources/Private/Language/locallang.xlf
+++ b/typo3/sysext/viewpage/Resources/Private/Language/locallang.xlf
@@ -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>
diff --git a/typo3/sysext/workspaces/Classes/Controller/ReviewController.php b/typo3/sysext/workspaces/Classes/Controller/ReviewController.php
index 5db3035e6e49..89be7f8e4059 100644
--- a/typo3/sysext/workspaces/Classes/Controller/ReviewController.php
+++ b/typo3/sysext/workspaces/Classes/Controller/ReviewController.php
@@ -165,7 +165,11 @@ class ReviewController
         }
         $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()
diff --git a/typo3/sysext/workspaces/Resources/Private/Language/locallang.xlf b/typo3/sysext/workspaces/Resources/Private/Language/locallang.xlf
index 375a9c2e57df..ee336ca5ac1a 100644
--- a/typo3/sysext/workspaces/Resources/Private/Language/locallang.xlf
+++ b/typo3/sysext/workspaces/Resources/Private/Language/locallang.xlf
@@ -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>
-- 
GitLab