Project

General

Profile

Actions

Bug #94677

closed

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

Added by Tina Westner over 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Site Handling, Site Sets & Routing
Target version:
-
Start date:
2021-07-30
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #89871: HrefLangGenerator: Wrong links generated with page translations that use a shortcutClosedChristian Eßl2019-12-06

Actions
Actions #1

Updated by Gerrit Code Review over 3 years ago

  • Status changed from New to Under Review

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70165

Actions #2

Updated by Nikita Hovratov about 3 years ago

  • Related to Bug #89871: HrefLangGenerator: Wrong links generated with page translations that use a shortcut added
Actions #3

Updated by Gerrit Code Review about 3 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70836

Actions #4

Updated by Nikita Hovratov about 3 years ago

  • Category changed from Content Rendering to Site Handling, Site Sets & Routing
  • TYPO3 Version changed from 10 to 11
  • Complexity deleted (easy)
  • Is Regression changed from No to Yes

Can confirm this.

Example setup:

Languages:
default (id=0), foobar.site
german (id=1), de.foobar.site
spanish (id=2, fallback: 1, fallback type: strict), es.foobar.site

Page A (id=450, Standard)
Translations (connected): 1, 2
Content: Menu->Pages [pages=452]

Page B (id=451, Standard)
Translations (connected): 1

Page C (id=452, Shortcut => 451)
Translations (connected): 1

Now open Page A with language 2:

Result Frontend:
de.foobar.site/translate-to-deutsch-page-b

Result expected:
es.foobar.site/translate-to-deutsch-page-b
Actions #5

Updated by Gerrit Code Review about 3 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70836

Actions #6

Updated by Gerrit Code Review about 3 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70836

Actions #7

Updated by Gerrit Code Review about 3 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70836

Actions #8

Updated by Nikita Hovratov about 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Benni Mack about 2 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF