diff --git a/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php b/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php index 359ff6c0a505df9aff5fa273b0866d7b54376cab..0c8c4c33a6ff6ea1e88cf8384c9c1204a0cbe76e 100644 --- a/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php +++ b/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php @@ -1085,7 +1085,7 @@ class PageRepository implements LoggerAwareInterface ->removeAll() ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); - $pageRec = $queryBuilder->select('uid', 'pid', 'doktype', 'mount_pid', 'mount_pid_ol', 't3ver_state') + $pageRec = $queryBuilder->select('uid', 'pid', 'doktype', 'mount_pid', 'mount_pid_ol', 't3ver_state', 'l10n_parent') ->from('pages') ->where( $queryBuilder->expr()->eq( @@ -1106,7 +1106,7 @@ class PageRepository implements LoggerAwareInterface } // Set first Page uid: if (!$firstPageUid) { - $firstPageUid = $pageRec['uid']; + $firstPageUid = (int)($pageRec['l10n_parent'] ?: $pageRec['uid']); } // Look for mount pid value plus other required circumstances: $mount_pid = (int)$pageRec['mount_pid']; @@ -1117,7 +1117,7 @@ class PageRepository implements LoggerAwareInterface ->removeAll() ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); - $mountRec = $queryBuilder->select('uid', 'pid', 'doktype', 'mount_pid', 'mount_pid_ol', 't3ver_state') + $mountRec = $queryBuilder->select('uid', 'pid', 'doktype', 'mount_pid', 'mount_pid_ol', 't3ver_state', 'l10n_parent') ->from('pages') ->where( $queryBuilder->expr()->eq( diff --git a/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php b/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php index 9db7f4cd333ea1ef664e9bbf0f353c88c4da7183..a87691127a881cf4550540a44564be50f51258e8 100644 --- a/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php +++ b/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php @@ -97,6 +97,35 @@ class PageRepositoryTest extends FunctionalTestCase self::assertCount(4, $rows); } + /** + * @test + */ + public function getMenuWithMountPoint() + { + $subject = new PageRepository(); + $rows = $subject->getMenu([1000]); + self::assertEquals('root default language', $rows[1003]['title']); + self::assertEquals('1001', $rows[1003]['uid']); + self::assertEquals('1001-1003', $rows[1003]['_MP_PARAM']); + self::assertCount(2, $rows); + } + + /** + * @test + */ + public function getMenuPageOverlayWithMountPoint() + { + $subject = new PageRepository(new Context([ + 'language' => new LanguageAspect(1) + ])); + $rows = $subject->getMenu([1000]); + self::assertEquals('root translation', $rows[1003]['title']); + self::assertEquals('1001', $rows[1003]['uid']); + self::assertEquals('1002', $rows[1003]['_PAGES_OVERLAY_UID']); + self::assertEquals('1001-1003', $rows[1003]['_MP_PARAM']); + self::assertCount(2, $rows); + } + /** * @test */ @@ -400,6 +429,36 @@ class PageRepositoryTest extends FunctionalTestCase self::assertSame($expectedSQL, $subject->where_hid_del); } + //////////////////////////////// + // Tests concerning mountpoints + //////////////////////////////// + /// + /** + * @test + */ + public function getMountPointInfoForDefaultLanguage() + { + $subject = new PageRepository(); + $mountPointInfo = $subject->getMountPointInfo(1003); + self::assertEquals('1001-1003', $mountPointInfo['MPvar']); + } + + /** + * @test + */ + public function getMountPointInfoForTranslation() + { + $mpVar = '1001-1003'; + $subject = new PageRepository(new Context([ + 'language' => new LanguageAspect(1) + ])); + $mountPointInfo = $subject->getMountPointInfo(1003); + self::assertEquals($mpVar, $mountPointInfo['MPvar']); + + $mountPointInfo = $subject->getMountPointInfo(1004); + self::assertEquals($mpVar, $mountPointInfo['MPvar']); + } + //////////////////////////////// // Tests concerning workspaces //////////////////////////////// diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/pages.xml b/typo3/sysext/core/Tests/Functional/Fixtures/pages.xml index 3eabf2b2271e097cb737ef4e7831faf2284b8a2a..db75fca99d622fcd9ca68aebae0947584a1686b5 100644 --- a/typo3/sysext/core/Tests/Functional/Fixtures/pages.xml +++ b/typo3/sysext/core/Tests/Functional/Fixtures/pages.xml @@ -132,4 +132,46 @@ <title>Attrappe 1-3-9</title> <deleted>0</deleted> </pages> + <pages> + <uid>1000</uid> + <pid>0</pid> + <doktype>1</doktype> + <sys_language_uid>0</sys_language_uid> + <title>MountPoint tests</title> + </pages> + + <pages> + <uid>1001</uid> + <pid>1000</pid> + <doktype>1</doktype> + <sys_language_uid>0</sys_language_uid> + <title>root default language</title> + </pages> + <pages> + <uid>1002</uid> + <pid>1000</pid> + <doktype>1</doktype> + <l10n_parent>1001</l10n_parent> + <sys_language_uid>1</sys_language_uid> + <title>root translation</title> + </pages> + <pages> + <uid>1003</uid> + <pid>1000</pid> + <doktype>7</doktype> + <mount_pid>1001</mount_pid> + <mount_pid_ol>1</mount_pid_ol> + <sys_language_uid>0</sys_language_uid> + <title>Mount default language</title> + </pages> + <pages> + <uid>1004</uid> + <pid>1000</pid> + <doktype>7</doktype> + <mount_pid>1001</mount_pid> + <mount_pid_ol>1</mount_pid_ol> + <l10n_parent>1003</l10n_parent> + <sys_language_uid>1</sys_language_uid> + <title>Mount translation</title> + </pages> </dataset> diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 96ab80d71e68676c6aa03aee551bfa540b3d5b30..284970bf1d0b6374aa8f76749ed339d7973cf76e 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -5381,7 +5381,7 @@ class ContentObjectRenderer implements LoggerAwareInterface } // Init vars: - $allFields = 'uid,hidden,starttime,endtime,fe_group,extendToSubpages,doktype,php_tree_stop,mount_pid,mount_pid_ol,t3ver_state' . $addSelectFields; + $allFields = 'uid,hidden,starttime,endtime,fe_group,extendToSubpages,doktype,php_tree_stop,mount_pid,mount_pid_ol,t3ver_state,l10n_parent' . $addSelectFields; $depth = (int)$depth; $begin = (int)$begin; $theList = []; diff --git a/typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php b/typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php index a16a63266f5fa41ac7a13143dd07315017801614..6f1f9ee69963f14e382b4287e5748d65ff074433 100644 --- a/typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php +++ b/typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php @@ -586,7 +586,7 @@ class PageLinkBuilder extends AbstractTypolinkBuilder ->removeAll() ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); $queryResult = $queryBuilder - ->select('uid', 'pid', 'doktype', 'mount_pid', 'mount_pid_ol', 't3ver_state') + ->select('uid', 'pid', 'doktype', 'mount_pid', 'mount_pid_ol', 't3ver_state', 'l10n_parent') ->from('pages') ->where( $queryBuilder->expr()->eq(