Issue Bug Closed

#94677Menu-item of type "shortcut" is language-overlayed twice

Tina Westner 07/30/21, 16:11 updated 10/04/22, 14:12

Description

I guess, this is a very detailed scenario and not many people will run into this, but I think I can be simply solved.

In our scenario we have a configuration like this:
domain1 runs with languageId 0.
domain2 runs with languageId 1.
domain3 runs with languageId 2 and has languageId 1 as fallback.

the error is visible while surfing on domain3 with many untranslated pages:
the hmenu renders all default menu items with domain3, but all shortcuts are targeting to domain2 (if they are not translated to language Id 2 and run into the fallback).

the reason for this is, that while generating the shortcut-menu-items the language overlay is done twice and
the link is rendered in languageId 1 instead of languageId 2.

\TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject, line 1371 ff
@
$shortcut = $tsfe->sys_page->getPageShortcut(…);
@
the result is a already translated page record with
_PAGES_OVERLAY => TRUE
_PAGES_OVERLAY_UID => ID_OF_ELEMENT_IN_LANGUAGE_ID_1
_PAGES_OVERLAY_LANGUAGE => 1
_PAGES_OVERLAY_REQUESTEDLANGUAGE => 2

afterwards the record is translated again:
@
if (isset($menuItem[‘_PAGES_OVERLAY_LANGUAGE’])) {
$shortcut = $tsfe->sys_page->getPageOverlay($shortcut, $menuItem[‘_PAGES_OVERLAY_LANGUAGE’]);
}
@
it returns:
_PAGES_OVERLAY => TRUE
_PAGES_OVERLAY_UID => ID_OF_ELEMENT_IN_LANGUAGE_ID_1
_PAGES_OVERLAY_LANGUAGE => 1
_PAGES_OVERLAY_REQUESTEDLANGUAGE => 1

for link generation the value of _PAGES_OVERLAY_REQUESTEDLANGUAGE is used, which is wrong and so the wrong domain is used.

IMHO all ways to get through getPageShortcut() will return a already translated page-record, so the if-statement can be deleted.

Reviews 3