How to add elements to the Content Element Wizard in typo3


The content element wizard can be fully configured using TSConfig.

The API described here should not be used for the purpose of customizing this wizard.

However for extension authors, it provides a way of registering their plugin with the new content element wizard.

Basically it is about adding a class reference to the $GLOBALS[‘TBE_MODULES_EXT’][‘xMOD_db_new_content_el’][‘addElClasses’] global array.

The keys in this array are class names and the values are the absolute paths to these class. The class must have a proc() method.

Here is some code from the “js_contact_form” extension, to register the “contactform” plugin with the wizard. First of all, the class is declared:

// add wizard icon to the "add new record" in backend
if (TYPO3_MODE == "BE") {
    $TBE_MODULES_EXT["xMOD_db_new_content_el"]["addElClasses"]["JsContactFormWizicon"] =
         \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Classes/Helper/JsContactFormWizicon.php';
}

The EXT:js_contact_form/Classes/Helper/JsContactFormWizicon.php file looks like:

<?php
/**
 * Created by Jainish Senjaliya.
 * User: Jainish
 * Date: 13.06.2015
 * Time: 15:01
 */
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;

/**
 * Class that adds the wizard icon.
 */
class JsContactFormWizicon {

    /**
     * Processing the wizard items array
     *
     * @param array $wizardItems : The wizard items
     * @return Modified array with wizard items
     */
    function proc( $wizardItems ) {

        $wizardItems['plugins_tx_jscontactform_contactform'] = array(
            'icon' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('js_contact_form') . 'Resources/Public/Icons/wizard_icon.png',
            'title' => $GLOBALS['LANG']->sL('LLL:EXT:js_contact_form/Resources/Private/Language/locallang.xlf:plugin-title'),
            'description' => $GLOBALS['LANG']->sL('LLL:EXT:js_contact_form/Resources/Private/Language/locallang.xlf:plugin-description'),
            'params' => '&defVals[tt_content][CType]=list&defVals[tt_content][list_type]=jscontactform_contactform'
        );

        return $wizardItems;
    }
}
?>

The proc() method receives the list of existing items in the wizard and adds a new one to it.

The first three properties (icon, title and description) are quite easy to understand.

The “params” property defines the default values to be added to the new record link so that the right type of content element (and plugin in this case) is already selected.

The entry added in the plugin list of the new content element wizard

The entry added in the plugin list of the new content element wizard

I have taken this example from Contact Form Extension from TYPO3 Repository. you may download and analyze this extension.

I hope this will help you more. Njoy 🙂 🙂

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

Leave a comment