DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Add DoktypesΒΆ

With the ConfigurationUtility you can add Doktypes the easy way

The best place for the following example is a ext_tables.php file.

// for easier usage just define the id of your new doktype as a constant
define('TX_YOURPLUGIN_PRODUCT', 60);
define('TX_YOURPLUGIN_NEWSARTICLE', 61);

// add a divider to the doktype select box
\FORM4\Form4Pages\Utility\ConfigurationUtility::addDoktypeSelectorDivider(
    'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_db.xml:pages.yourplugin.divider'
);

// next follows just the add of the doktype
// the method needs 3 parameters: doktype id, label and icon file path
\FORM4\Form4Pages\Utility\ConfigurationUtility::addDoktype(
     TX_YOURPLUGIN_PRODUCT,
    'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_db.xml:pages.doktype.product',
    'EXT:' . $_EXTKEY . '/Resources/Public/Icons/product.png'
);
\FORM4\Form4Pages\Utility\ConfigurationUtility::addDoktype(
     TX_YOURPLUGIN_NEWSARTICLE,
    'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_db.xml:pages.doktype.newsarticle',
    'EXT:' . $_EXTKEY . '/Resources/Public/Icons/newsarticle.png'
);

ConfigurationUtility::addDoktype() accepts two more (optional) parameters.

/**
 * Registers a new doktype.
 *
 * @param integer $key Doktype key
 * @param string $label Label used in backend
 * @param string $icon Icon used in backend
 * @param integer $copyTcaType TCA type configuration that is copied for the new doktype
 * @param boolean $noOverlay Do not add the doktype to pages_language_overlay
 * @return void
 */
public static function addDoktype($key, $label, $icon, $copyTcaType = 1, $noOverlay = FALSE)