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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use B13\Container\Domain\Factory\Exception;
use B13\Container\Domain\Factory\PageView\Backend\ContainerFactory;
use B13\Container\Tca\Registry;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\Event\ManipulateBackendLayoutColPosConfigurationForPageEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;
Expand All @@ -29,7 +28,7 @@ public function __construct(protected ContainerFactory $containerFactory, protec

public function __invoke(ManipulateBackendLayoutColPosConfigurationForPageEvent $e)
{
$parent = $this->getParentUid($e->request);
$parent = $this->getParentUid($e);
if ($parent === null) {
return;
}
Expand All @@ -48,8 +47,9 @@ public function __invoke(ManipulateBackendLayoutColPosConfigurationForPageEvent
];
}

private function getParentUid(?ServerRequestInterface $request): ?int
private function getParentUid(ManipulateBackendLayoutColPosConfigurationForPageEvent $e): ?int
{
$request = $e->request;
if ($request === null) {
return null;
}
Expand All @@ -74,8 +74,8 @@ private function getParentUid(?ServerRequestInterface $request): ?int
}
$recordUid = abs((int)$recordUid);
// TcaCTypeItems: edit record
$record = BackendUtility::getRecord('tt_content', $recordUid, 'tx_container_parent');
if (isset($record['tx_container_parent'])) {
$record = BackendUtility::getRecord('tt_content', $recordUid, 'tx_container_parent,colPos');
if (isset($record['tx_container_parent']) && (int)$record['colPos'] === $e->colPos) {
return (int)$record['tx_container_parent'];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,20 @@ public function editContainerChildElement(): void
$listener($e);
self::assertSame(['allowedContentTypes' => 'header, textmedia, b13-2cols', 'disallowedContentTypes' => ''], $e->configuration);
}

#[Test]
public function editContainerChildElementWithWrongColPos(): void
{
// https://forge.typo3.org/issues/110106
if ((new Typo3Version())->getMajorVersion() < 14) {
self::markTestSkipped('only v14');
}
$this->importCSVDataSet(__DIR__ . '/Fixtures/ManipulateBackendLayoutColPosConfigurationForPageTest.csv');
$request = new ServerRequest();
$request = $request->withQueryParams(['edit' => ['tt_content' => [1 => 'edit']]]);
$e = new ManipulateBackendLayoutColPosConfigurationForPageEvent([], new BackendLayout('foo', 'bar', []), 0, 1, $request);
$listener = $this->getContainer()->get(ManipulateBackendLayoutColPosConfigurationForPage::class);
$listener($e);
self::assertSame([], $e->configuration);
}
}