Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Classes/Domain/Factory/FrontendContainerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ public function buildContainer(ContentObjectRenderer $cObj, Context $context, ?i
if ($uid === null) {
$record = $cObj->data;
} else {
$records = $cObj->getRecords('tt_content', ['where' => 'uid=' . $uid]);
$records = $cObj->getRecords('tt_content', ['uidInList' => $uid, 'pidInList' => 0]);
if (empty($records)) {
throw new Exception('no record ' . $uid, 1734946029);
}
$record = $records[0];
}
if (!$this->tcaRegistry->isContainerElement($record['CType'])) {
if (!$this->tcaRegistry->isContainerElement($record['CType'] ?? '')) {
throw new Exception('not a container element with uid ' . $uid, 1734946028);
}
$conf = ['where' => 'tx_container_parent=' . $record['uid'], 'orderBy' => 'sorting'];
$conf = ['where' => 'tx_container_parent=' . $record['uid'], 'orderBy' => 'sorting', 'pidInList' => $record['pid']];
/** @var LanguageAspect $languageAspect */
$languageAspect = $context->getAspect('language');
if ($languageAspect->getOverlayType() === LanguageAspect::OVERLAYS_OFF && $record['l18n_parent'] > 0) {
Expand Down
23 changes: 23 additions & 0 deletions Tests/Functional/Frontend/DefaultLanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,29 @@ public function childrenAreRenderedAsSorted(): void
self::assertStringContainsString('<h6>first child</h6><h6>second child</h6>', $body);
}

/**
* @test
* @group frontend
*/
public function canRenderContainerFromOtherPage(): void
{
$this->importCSVDataSet(__DIR__ . '/Fixtures/ContainerFromOtherPage.csv');
$this->setUpFrontendRootPage(
1,
[
'constants' => ['EXT:container/Tests/Functional/Frontend/Fixtures/TypoScript/constants.typoscript'],
'setup' => [
'EXT:container/Tests/Functional/Frontend/Fixtures/TypoScript/container_from_other_page.typoscript',
],
]
);
$response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/'));
$body = (string)$response->getBody();
$body = $this->prepareContent($body);
self::assertStringContainsString('<h2>left side (201)</h2><div class="left-children"><h6 class="left-children">child</h6><div id="c2"', $body);

}

/**
* @test
* @group frontend
Expand Down
9 changes: 9 additions & 0 deletions Tests/Functional/Frontend/Fixtures/ContainerFromOtherPage.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"pages"
,"uid","pid","title","slug"
,"1","0","page-1","/"
,"2","1","page-2","page-2"
"tt_content"
,"uid","pid","CType","header","sorting","colPos","tx_container_parent"
,"1","2","b13-2cols-with-header-container","container","256","0","0"
,"2","2","header","child","384","201","1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import 'EXT:fluid_styled_content/Configuration/TypoScript/setup.typoscript'
@import 'EXT:container_example/Configuration/TypoScript/setup.typoscript'

page = PAGE
page.config.disableAllHeaderCode = 1
page.20 < tt_content.b13-2cols-with-header-container
page.20.dataProcessing.200.contentId = 1