#108284Avoid breaking change in DocHeaderComponent
Description
With #107875 a change was made that affected the Module submenu selector to require a label for the DropDownButton.
However, existing modules might have created a docheader like this:
$menu = $moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
$menu->setIdentifier('cruPsr14EventList');
$menuItems = [
'index' => [
'controller' => 'Module',
'action' => 'index',
'route' => 'tx_psr14_event_list_index',
'label' => "Index",
],
'list' => [
'controller' => 'Module',
'action' => 'listCoreEventsAction',
'route' => 'tx_psr14_event_list_list',
'label' => "List",
]
];
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
foreach ($menuItems as $menuItemConfig) {
$currentUri = $request->getUri();
$action = $menuItemConfig['route'];
$uri = $uriBuilder->buildUriFromRoute($action, [$request]);
$isActive = ($currentUri === $uri);
$menuItem = $menu->makeMenuItem()
->setTitle($menuItemConfig['label'])
->setHref((string)$uri)
->setActive($isActive);
$menu->addMenuItem($menuItem);
}
$moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
This was fine in v12+v13, but breaks in v13 because no `$menu->setLabel(…)` call was required before.
To fix this, a specific label could be set.