Bug #101118


Missing translated menu entries if page is loaded via content_from_pid

Added by David Hedden about 1 year ago. Updated 3 months ago.

Should have
Link Handling, Site Handling & Routing
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:

Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Story #101565: Frontend related translation issuesNew2023-08-03

Actions #1

Updated by David Hedden about 1 year ago

Problem found in 10.4, but from checking the source code it should be present in newer versions aswell.

If the current shown page is loaded via content_from_pid and a fallback language. Only pages that are also the fallback language are shown in the menu.
This happens because the menu is generated with pages that can have the fallback language uid or the requested language, but the filterMenuPages function filters with a changed context so it filters out the requested language.

     protected function resolveTranslatedPageId()
         $this->page = $this->sys_page->getPage($this->id);
         // Accessed a default language page record, nothing to resolve
         if (empty($this->page) || (int)$this->page[$GLOBALS['TCA']['pages']['ctrl']['languageField']] === 0) {
         $languageId = (int)$this->page[$GLOBALS['TCA']['pages']['ctrl']['languageField']];
         $this->page = $this->sys_page->getPage($this->page[$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField']]);
         $this->context->setAspect('language', GeneralUtility::makeInstance(LanguageAspect::class, $languageId));
         $this->id = $this->page['uid'] ?? 0;

         // If the page is hide in menu, but the menu does not include them do not show the page
         if (($data['nav_hide'] ?? false) && !($this->conf['includeNotInMenu'] ?? false)) {
             return false;
         // Checking if a page should be shown in the menu depending on whether a translation exists or if the default language is disabled
         if (!$this->sys_page->isPageSuitableForLanguage($data, $this->getCurrentLanguageAspect())) {
             return false;
         // Checking if the link should point to the default language so links to non-accessible pages will not happen
         if ($languageId > 0 && !empty($this->conf['protectLvar'])) {
             $pageTranslationVisibility = new PageTranslationVisibility((int)($data['l18n_cfg'] ?? 0));
             if ($this->conf['protectLvar'] === 'all' || $pageTranslationVisibility->shouldHideTranslationIfNoTranslatedRecordExists()) {
                 $olRec = $this->sys_page->getPageOverlay($data['uid'], $languageId);
                 if (empty($olRec)) {
                     // If no page translation record then page can NOT be accessed in
                     // the language pointed to, therefore we protect the link by linking to the default language
                     $data['_PAGES_OVERLAY_REQUESTEDLANGUAGE'] = '0';
         return true;

In my case a quick fix was reinitializing the language aspect after running getPageAndRootline since this is the only function that still uses resolveTranslatedPageId.

I suspect there could be more Problems off this kind, since the language aspect is not always initialized with a factory but fetched from the context. So in this case it would be wrong and also without the defined fallback chain.

Actions #2

Updated by David Hedden about 1 year ago

  • Subject changed from Missing translated menu entries if page is a mount point to Missing translated menu entries if page is loaded via content_from_pid
Actions #3

Updated by Astrid Haubold 9 months ago

  • Related to Story #101565: Frontend related translation issues added
Actions #4

Updated by David Hedden 3 months ago · Edited

Issue was solved with #97533 for 12.4


Also available in: Atom PDF