Skip to content

Commit 2814888

Browse files
committed
[BUGFIX] change hardcoded container.removeItems > $group.removeItems. | in case there are multiple containers they all get unset
1 parent 43adcce commit 2814888

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Classes/Tca/Registry.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ public function getPageTsString(): string
259259
$groupedByGroup = [];
260260
$defaultGroup = 'container';
261261

262-
$content = '';
263262
$typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
263+
$cTypesByGroup = [];
264264

265265
foreach ($GLOBALS['TCA']['tt_content']['containerConfiguration'] as $cType => $containerConfiguration) {
266266
if ($containerConfiguration['registerInNewContentElementWizard'] === true) {
@@ -275,10 +275,19 @@ public function getPageTsString(): string
275275
}
276276
';
277277
// s. https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.0/Breaking-102834-RemoveItemsFromNewContentElementWizard.html
278-
if ($typo3Version->getMajorVersion() >= 13 && $containerConfiguration['registerInNewContentElementWizard'] === false) {
279-
$content .= "mod.wizards.newContentElement.wizardItems.container.removeItems := addToList({$containerConfiguration["cType"]})";
280-
return $pageTs . LF . $content;
278+
if ($typo3Version->getMajorVersion() > 12) {
279+
if ($containerConfiguration['registerInNewContentElementWizard'] === false) {
280+
$group = $containerConfiguration['group'] !== '' ? $containerConfiguration['group'] : $defaultGroup;
281+
$cTypesByGroup[$group][] = $cType;
282+
}
283+
}
284+
}
285+
286+
if ($typo3Version->getMajorVersion() > 12 && !empty($cTypesByGroup)) {
287+
foreach ($cTypesByGroup as $group => $ctypes) {
288+
$pageTs .= LF . 'mod.wizards.newContentElement.wizardItems.' . $group . '.removeItems := addToList(' . implode(',', $ctypes) . ')';
281289
}
290+
return $pageTs;
282291
}
283292

284293
foreach ($groupedByGroup as $group => $containerConfigurations) {

0 commit comments

Comments
 (0)