Summary
When a container allows only 1 specific content element type, its creationOptions are ignored when adding it to the container.
TYPO3 13: defaultValues, saveAndClose
TYPO3 14: additionally enableDirectRecordTypeCreation, title
creationOptions in TYPO3 docs
Example code
$GLOBALS['TCA']['tt_content']['types']['header']['creationOptions']['defaultValues'] = ['sectionIndex'=>0, 'header'=>'Example header', 'header_layout'=>5];
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Container\Tca\Registry::class)->configureContainer(
(
new \B13\Container\Tca\ContainerConfiguration(
'b13-2cols-with-header-container', // CType
'2 Column Container With Header', // label
'Some Description of the Container', // description
[
[
['name' => 'header', 'colPos' => 200, 'colspan' => 2, 'allowed' => ['CType' => 'header']]
],
[
['name' => 'left side', 'colPos' => 201],
['name' => 'right side', 'colPos' => 202]
]
] // grid configuration
)
)
// set an optional icon configuration
->setIcon('EXT:container_example/Resources/Public/Icons/b13-2cols-with-header-container.svg')
);
Adds creation Options to the header CType.
Adds a container with a header column, where only the header CType is allowed.
Adding content to the header column selects the correct CType, but ignores the creationOptions/ defaultValues
Cause
B13\Container\Backend\Preview\GridRenderer::getDefValsForContentDefenderAllowsOnlyOneSpecificContentType()
protected function getDefValsForContentDefenderAllowsOnlyOneSpecificContentType(string $cType, int $colPos): ?array
{
$allowedCTypes = (array)$this->tcaRegistry->getAllowedCTypesInColumn($cType, $colPos);
if (count($allowedCTypes) === 1) {
return ['CType' => $allowedCTypes[0]];
}
return null;
}
The function only returns the CType to the defVal parameters.
Suggested Fix
Comparison with TYPO3 core backend-layout:
mod.web_layout.BackendLayouts {
Subpage {
title = Subpage
config {
backend_layout {
colCount = 1
rowCount = 2
rows {
1 {
columns {
1 {
name = Header
colPos = 1
allowedContentTypes = header
}
}
}
2 {
columns {
1 {
name = Content
colPos = 0
}
}
}
}
}
}
}
}
When adding content to the header column, and in contrast to EXT:containr, the New Content Element Wizard is opened with the one allowed CType

which results in the creation Options being applied:
My suggestion is to remove the function to let TYPO3 handle the defaultValues/ creationOptions. This will have EXT:container use the same behaviour as TYPO3 core (display the New Content Element Wizard) when there is only one allowed content element type in the column.
I will add a PR.
Summary
When a container allows only 1 specific content element type, its creationOptions are ignored when adding it to the container.
TYPO3 13: defaultValues, saveAndClose
TYPO3 14: additionally enableDirectRecordTypeCreation, title
creationOptions in TYPO3 docs
Example code
Adds creation Options to the
headerCType.Adds a container with a header column, where only the
headerCType is allowed.Adding content to the header column selects the correct CType, but ignores the creationOptions/ defaultValues
Cause
B13\Container\Backend\Preview\GridRenderer::getDefValsForContentDefenderAllowsOnlyOneSpecificContentType()The function only returns the CType to the defVal parameters.
Suggested Fix
Comparison with TYPO3 core backend-layout:
When adding content to the header column, and in contrast to EXT:containr, the New Content Element Wizard is opened with the one allowed CType

which results in the creation Options being applied:
My suggestion is to remove the function to let TYPO3 handle the defaultValues/ creationOptions. This will have EXT:container use the same behaviour as TYPO3 core (display the New Content Element Wizard) when there is only one allowed content element type in the column.
I will add a PR.