Skip to content

[BUGFIX] Remove ContentDefenderAllowsOnlyOneSpecificContentType check - #774

Closed
thomasrawiel wants to merge 1 commit into
b13:masterfrom
thomasrawiel:feature/fix-773-oneCType
Closed

thomasrawiel wants to merge 1 commit into
b13:masterfrom
thomasrawiel:feature/fix-773-oneCType

Conversation

@thomasrawiel

@thomasrawiel thomasrawiel commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor
  • Remove the function, that checks if only one specific content type is allowed
  • default to using the New Content Element wizard when building the new content url

resolves #773

Tested in TYPO3 13 with the following configuration (tca/overrides/tt_content.php):
with and without EXT:content_defender installed.

$GLOBALS['TCA']['tt_content']['types']['header']['creationOptions']['defaultValues'] = ['sectionIndex'=>0, 'header'=>'Example header', 'header_layout'=>5];
    $GLOBALS['TCA']['tt_content']['types']['header']['creationOptions']['saveAndClose'] = true;

    \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')
    );

Tested in TYPO3 14 with the following configuration:

$GLOBALS['TCA']['tt_content']['types']['header']['creationOptions']['defaultValues'] = ['sectionIndex'=>0, 'header'=>'Example header', 'header_layout'=>5];
    $GLOBALS['TCA']['tt_content']['types']['header']['creationOptions']['saveAndClose'] = true;
    $GLOBALS['TCA']['tt_content']['types']['header']['creationOptions']['title'] = 'My test title for the header CType';

    \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')
    );

Remove the function, that checks if only one specific content type is allowed and defaults to using the New Content Element wizard when building the new content url

resolves b13#773
@achimfritz

Copy link
Copy Markdown
Contributor

Hi @thomasrawiel , thanks for PR, and for Bugreport. We want to keep the Feature to skip new content element wizard, so i have created anothter PR, s. #777, is this working for you?

achimfritz added a commit that referenced this pull request Oct 9, 2026
If a container column allows exactly one CType, the new content
element wizard is skipped and FormEngine is opened directly with
the CType as default value. The creationOptions of this CType were
ignored in that case, although the core wizard applies them.

The creationOptions are now evaluated when the new content URL is
built:

 - defaultValues are added to defVals, LLL labels are translated.
   CType, colPos, sys_language_uid and tx_container_parent always
   take precedence.

 - saveAndClose creates the record directly via DataHandler
   (tce_db) instead of opening FormEngine, like the core wizard
   does.

Relates to: #774
@achimfritz

Copy link
Copy Markdown
Contributor

closed due #777 is merged

@achimfritz achimfritz closed this Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] container ignores creationOptions if only 1 contentElementType is allowed

2 participants