ModifyNewContentElementWizardItemsEvent

New in version 12.0: This event serves as a more powerful and flexible alternative for the removed hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'].

The event is called after TYPO3 has already prepared the wizard items, defined in TSconfig (mod.wizards.newContentElement.wizardItems).

The event allows listeners to modify any available wizard item as well as adding new ones. It’s therefore possible for the listeners to e.g. change the configuration, the position or to remove existing items altogether.

API

class TYPO3\CMS\Backend\Controller\Event\ModifyNewContentElementWizardItemsEvent

Listeners to this Event will be able to modify the wizard items of the new content element wizard component

getWizardItems()
Return type:array
setWizardItems(array wizardItems)
Parameters:
  • $wizardItems (array) – the wizardItems
hasWizardItem(string identifier)
Parameters:
  • $identifier (string) – the identifier
Return type:

bool

getWizardItem(string identifier)
Parameters:
  • $identifier (string) – the identifier
Return type:

array

setWizardItem(string identifier, array configuration, array position = array (

))

Add a new wizard item with configuration at a defined position.

Can also be used to relocate existing items and to modify their configuration.

param string $identifier:
 the identifier
param array $configuration:
 the configuration
param array $position:
 the position, default: array (

)

removeWizardItem(string identifier)
Parameters:
  • $identifier (string) – the identifier
Return type:

bool

getPageInfo()

Provides information about the current page making use of the wizard.

Return type:array
getColPos()

Provides information about the column position of the button that triggered the wizard.

Return type:int
getSysLanguage()

Provides information about the language used while triggering the wizard.

Return type:int
getUidPid()

Provides information about the element to position the new element after (uid) or into (pid).

Return type:int

Example

Registration of the Event in your extensions’ Services.yaml:

EXT:my_extension/Configuration/Services.yaml
MyVendor\MyPackage\Backend\MyEventListener:
  tags:
    - name: event.listener
      identifier: 'my-package/backend/modify-wizard-items'

The corresponding event listener class:

EXT:my_extension/Classes/Backend/MyEventListener.php
use TYPO3\CMS\Backend\Controller\Event\ModifyNewContentElementWizardItemsEvent;

class MyEventListener {

    public function __invoke(ModifyNewContentElementWizardItemsEvent $event): void
    {
        // Add a new wizard item after "textpic"
        $event->setWizardItem(
            'my_element',
            [
                'iconIdentifier' => 'icon-my-element',
                'title' => 'My element',
                'description' => 'My element description',
                'tt_content_defValues' => [
                    'CType' => 'my_element'
                ],
            ],
            ['after' => 'common_textpic']
        );
    }
}