Skip to content

Commit 2f5a134

Browse files
committed
[BUGFIX] add pidInList to query
Fixes: #580 Fixes: #582
1 parent 4314e9a commit 2f5a134

File tree

4 files changed

+42
-3
lines changed

4 files changed

+42
-3
lines changed

Classes/Domain/Factory/FrontendContainerFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ public function buildContainer(ContentObjectRenderer $cObj, Context $context, ?i
3434
if ($uid === null) {
3535
$record = $cObj->data;
3636
} else {
37-
$records = $cObj->getRecords('tt_content', ['where' => 'uid=' . $uid]);
37+
$records = $cObj->getRecords('tt_content', ['uidInList' => $uid, 'pidInList' => 0]);
3838
if (empty($records)) {
3939
throw new Exception('no record ' . $uid, 1734946029);
4040
}
4141
$record = $records[0];
4242
}
43-
if (!$this->tcaRegistry->isContainerElement($record['CType'])) {
43+
if (!$this->tcaRegistry->isContainerElement($record['CType'] ?? '')) {
4444
throw new Exception('not a container element with uid ' . $uid, 1734946028);
4545
}
46-
$conf = ['where' => 'tx_container_parent=' . $record['uid'], 'orderBy' => 'sorting'];
46+
$conf = ['where' => 'tx_container_parent=' . $record['uid'], 'orderBy' => 'sorting', 'pidInList' => $record['pid']];
4747
/** @var LanguageAspect $languageAspect */
4848
$languageAspect = $context->getAspect('language');
4949
if ($languageAspect->getOverlayType() === LanguageAspect::OVERLAYS_OFF && $record['l18n_parent'] > 0) {

Tests/Functional/Frontend/DefaultLanguageTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,29 @@ public function childrenAreRenderedAsSorted(): void
6262
self::assertStringContainsString('<h6>first child</h6><h6>second child</h6>', $body);
6363
}
6464

65+
/**
66+
* @test
67+
* @group frontend
68+
*/
69+
public function canRenderContainerFromOtherPage(): void
70+
{
71+
$this->importCSVDataSet(__DIR__ . '/Fixtures/ContainerFromOtherPage.csv');
72+
$this->setUpFrontendRootPage(
73+
1,
74+
[
75+
'constants' => ['EXT:container/Tests/Functional/Frontend/Fixtures/TypoScript/constants.typoscript'],
76+
'setup' => [
77+
'EXT:container/Tests/Functional/Frontend/Fixtures/TypoScript/container_from_other_page.typoscript',
78+
],
79+
]
80+
);
81+
$response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/'));
82+
$body = (string)$response->getBody();
83+
$body = $this->prepareContent($body);
84+
self::assertStringContainsString('<h2>left side (201)</h2><div class="left-children"><h6 class="left-children">child</h6><div id="c2"', $body);
85+
86+
}
87+
6588
/**
6689
* @test
6790
* @group frontend
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"pages"
2+
,"uid","pid","title","slug"
3+
,"1","0","page-1","/"
4+
,"2","1","page-2","page-2"
5+
"tt_content"
6+
,"uid","pid","CType","header","sorting","colPos","tx_container_parent"
7+
,"1","2","b13-2cols-with-header-container","container","256","0","0"
8+
,"2","2","header","child","384","201","1"
9+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@import 'EXT:fluid_styled_content/Configuration/TypoScript/setup.typoscript'
2+
@import 'EXT:container_example/Configuration/TypoScript/setup.typoscript'
3+
4+
page = PAGE
5+
page.config.disableAllHeaderCode = 1
6+
page.20 < tt_content.b13-2cols-with-header-container
7+
page.20.dataProcessing.200.contentId = 1

0 commit comments

Comments
 (0)