Skip to content

Conversation

@AquaTixzzZ
Copy link
Contributor

@AquaTixzzZ AquaTixzzZ commented Sep 24, 2025

Description

Currently when setting the flag ->setRegisterInNewContentElementWizard(false) nothing happens in v13.
this is happening because the pageTS is returned early before it is build. the code in action
A hint was already given in the comment namely the changelog.
https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.0/Breaking-102834-RemoveItemsFromNewContentElementWizard.html

The goal

respecting the setting given by the TCA override `->setRegisterInNewContentElementWizard(false)``

Scope

13.4

understanding the change

Before we return the pageTs early we first check if there is a container that needs to be unset. If so the early returned pageTS will now contain the logic to remove the containers we don't want to see.

links

extra information

Tested it in a ddev v12 environment and ddev v13 environment.

tested

✅ single container
✅ multipe containers

@AquaTixzzZ
Copy link
Contributor Author

this wont work. fails on multipe containers... will look into it tomorrow or somebody can take it over

return $pageTs;
if ($typo3Version->getMajorVersion() >= 13 && $containerConfiguration['registerInNewContentElementWizard'] === false) {
$content .= "mod.wizards.newContentElement.wizardItems.container.removeItems := addToList({$containerConfiguration["cType"]})";
return $pageTs . LF . $content;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure this return statement shouldn't be in foreach loop, but after it.

Copy link
Contributor Author

@AquaTixzzZ AquaTixzzZ Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're absolutely right. also saw it! also left a comment and changed the pr description. thank you

@achimfritz
Copy link
Contributor

achimfritz commented Sep 25, 2025

thanks for PR, i think code should be like this:

[email protected]:~/src/projects/core13/src/extensions/container$ git diff
diff --git a/Classes/Tca/Registry.php b/Classes/Tca/Registry.php
index 2e4b10d..efca3db 100644
--- a/Classes/Tca/Registry.php
+++ b/Classes/Tca/Registry.php
@@ -273,6 +273,11 @@ class Registry implements SingletonInterface
         $typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
         if ($typo3Version->getMajorVersion() > 12) {
             // s. https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.0/Breaking-102834-RemoveItemsFromNewContentElementWizard.html
+            foreach ($groupedByGroup as $group => $containerConfigurations) {
+                if ($containerConfiguration['registerInNewContentElementWizard'] === false) {
+                    $pageTs .= LF . 'mod.wizards.newContentElement.wizardItems.' . $group . '.removeItems := addToList(' . $containerConfiguration['cType'] . ')';
+                }
+            }
             return $pageTs;
         }

(i can care about it, and i think we have to fix also the tt_content_defValues from $containerConfiguration['defaultValues']

@AquaTixzzZ
Copy link
Contributor Author

AquaTixzzZ commented Sep 25, 2025

@achimfritz for multiple containers it needs to be a bit different i think.
Might been a cache problem or a typo on my side but i thought that if $content contains multipe removeItems in one string like so :
mod.wizards.newContentElement.wizardItems.container.removeItems := addToList(1col-container,)
mod.wizards.newContentElement.wizardItems.container.removeItems := addToList(2col-container,)

it only unsets the first item. might be that this is not a valid syntax and that it needs to be addToList(1col-container, 2col-container)
if thats the case we may need to loop through al ctypes and implode it inside addToList(implode(",", $ctypes)).

if you want i could take a look tonight when i'm home. could be that i was just tired and saw things that weren't there whhahah. could give you a definite answer tonight

@AquaTixzzZ AquaTixzzZ force-pushed the BUGFIX/628-hide-element-in-wizard branch 3 times, most recently from ceb5d7a to 2814888 Compare September 25, 2025 17:57
@AquaTixzzZ
Copy link
Contributor Author

@achimfritz @chesio Thank you both for checking the PR. I fixed the hardcoding of container.removeItems.
for the TsConfig syntax. both multiple lines concatenated like this is valid : mod.wizards.newContentElement.wizardItems.container.removeItems := addToList(1col-container,) mod.wizards.newContentElement.wizardItems.container.removeItems := addToList(2col-container,)

but also
mod.wizards.newContentElement.wizardItems.container.removeItems := addToList(1col-container,2col-container).

i think i went for a okay approach in the PR.

I explicitly didn't squash for the reviewing not being a mess in github. if its okay please let me know i wil squash it before merging. You could also take it as a base.

Copy link
Contributor

@achimfritz achimfritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after that i will be happy with your PR and it will be nice, if you squash the commit.
Thanks again.

$defaultGroup = 'container';

$typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
$cTypesByGroup = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would prefer to give a more readable name for the variable, e.g. $cTypesExcludedInNewContentElementWizard


if ($typo3Version->getMajorVersion() > 12 && !empty($cTypesByGroup)) {
foreach ($cTypesByGroup as $group => $ctypes) {
$pageTs .= LF . 'mod.wizards.newContentElement.wizardItems.' . $group . '.removeItems := addToList(' . implode(',', $ctypes) . ')';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have to increase the count of the ignored errors in each Build/phpstan-baseline-1<1-3>.neon to make CI happy
e.g.

+++ b/Build/phpstan-baseline-13.neon
@@ -3,7 +3,7 @@ parameters:
 
                -
                        message: "#^Constant LF not found\\.$#"
-                       count: 4
+                       count: 5
                        path: ../Classes/Tca/Registry.php

@AquaTixzzZ
Copy link
Contributor Author

Hey! i had a busy weekend. will fix it tonight. Sharp of you too see the naming convention. I agree with changing it, also with bumping up the count of the error in de stan files. I will make a loose commit to easily see the change. If all is good i will squash it.

@AquaTixzzZ
Copy link
Contributor Author

@achimfritz pushed the renaming and error in a loose commit ready for review. Let me know if it's all good. Then i will squash it.

Copy link
Contributor

@achimfritz achimfritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@AquaTixzzZ AquaTixzzZ force-pushed the BUGFIX/628-hide-element-in-wizard branch from af7243d to 9438301 Compare October 2, 2025 19:24
@AquaTixzzZ
Copy link
Contributor Author

@achimfritz everything is squashed. Commit name is also fitting?

Copy link
Contributor

@achimfritz achimfritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@achimfritz achimfritz closed this Oct 6, 2025
@achimfritz achimfritz reopened this Oct 6, 2025
@achimfritz achimfritz merged commit 7ff2844 into b13:master Oct 6, 2025
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.

3 participants