Feature: #102834 - Auto-registration of New Content Element Wizard via TCA

See forge#102834

Description

Content element types defined in TCA field CType are now automatically registered for the New Content Element Wizard. This replaces the former extra step to define a wizard entry in page TSconfig mod.wizards.newContentElement.wizardItems.<group>.

The item entries value, label, description, group and icon are used to define the wizard entry.

The migration looks as follows:

# Add a new element (header) to the "common" group
mod.wizards.newContentElement.wizardItems.common.elements.header {
   iconIdentifier = content-header
   title = LLL:EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf:common_headerOnly_title
   description = LLL:EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf:common_headerOnly_description
   tt_content_defValues {
      CType = header
   }
}
mod.wizards.newContentElement.wizardItems.common.show := addToList(header)
Copied!
<?php

return [
    'columns' => [
        'CType' => [
            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.type',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.header',
                        'description' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.header.description',
                        'value' => 'header',
                        'icon' => 'content-header',
                        'group' => 'default',
                    ],
                ],
            ],
        ],
    ],
];
Copied!

The saveAndClose option is now defined through TCA as well:

mod.wizards.newContentElement.wizardItems {
    special.elements {
        div {
            saveAndClose = true
        }
    }
}
Copied!
<?php

return [
    'types' => [
        'div' => [
            'creationOptions' => [
                'saveAndClose' => true,
            ],
        ],
    ],
];
Copied!

The same goes for the default values. The option has been renamed from tt_content_defValues to defaultValues:

mod.wizards.newContentElement.wizardItems {
    special.elements {
        html {
            tt_content_defValues {
                bodytext = some text
            }
        }
    }
}
Copied!
<?php

return [
    'types' => [
        'html' => [
            'creationOptions' => [
                'defaultValues' => [
                    'bodytext' => 'some text'
                ],
            ],
        ],
    ],
];
Copied!

Removing items from the select box still works as before through page TSconfig TCEFORM. This will remove both the TCA items entry and the wizard entry.

TCEFORM.tt_content.CType {
    removeItems := addToList(header)
}
Copied!

To hide groups or elements in the wizard a new option removeItems is available.

# Before
mod.wizards.newContentElement.wizardItems.special.show := removeFromList(html)

# After
mod.wizards.newContentElement.wizardItems.special.removeItems := addToList(html)
Copied!

As mentioned, it's also possible to remove a whole group:

# This will remove the "menu" group
mod.wizards.newContentElement.wizardItems.removeItems := addToList(menu)
Copied!

Impact

The groups and elements of the new Content Element Wizard are now registered automatically from the TCA type field. This eases the creation of new content elements and plugins for integrators and developers, since the whole definition is done at a central place.