Actions
Bug #85388
closedWrong page category returned in getRootLine in a localized setup
Start date:
2018-06-26
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
The returned category is taken with the uid from the pages_language_overlay instead of the default page uid.
Updated by Daniel Huf over 6 years ago
Structure¶
Pages
- Home (uid=1) `-- Lessons (uid=24) | overlay:Formations (uid=44) `--- Planning (uid=13) | overlay:Planification (uid=62) `-- Ice climbing (uid=44)
Categories
- Lesson (uid = 3) // Default German - Formation // French - Ice Climbing (uid = 78)// Default German
My category is assigned to "page A".
Code (not working)¶
$pageId = 13; // "Planning" but in the french view $pageRepository = $this->getTypoScriptFrontendController()->sys_page; $rootline = $pageRepository->getRootLine($pageId); foreach ($rootline as $rootlinePage) { if ($rootlinePage['categories']) { $categoryId = explode(',', $rootlinePage['categories'])[0]; $category = $this->categoryRepository->findByUid($categoryId); // return the category Ice Climbing (78) var_dump($category); } }
Code (working but why?)¶
$pageId = 13; // "Planning" but in the french view // Mind the difference to instantiate $pageRepository? $pageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class); $rootline = $pageRepository->getRootLine($pageId); foreach ($rootline as $rootlinePage) { if ($rootlinePage['categories']) { $categoryId = explode(',', $rootlinePage['categories'])[0]; $category = $this->categoryRepository->findByUid($categoryId); // return the category Lesson (uid=3) var_dump($category); } }
Updated by Daniel Huf over 6 years ago
- Priority changed from Must have to Should have
Updated by Susanne Moog about 6 years ago
- Target version changed from 8.7.19 to Candidate for patchlevel
Updated by Susanne Moog over 4 years ago
- Status changed from New to Closed
In newer versions of TYPO3 (9, 10) sys_page and the PageRepository are both using the context to set language specific settings and behave the same way. Closing this issue now. If it still occurs, feel free to comment.
Actions