<?php
defined('TYPO3') || die();


/***************
 * Add content element to selector list
 */
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
    'tt_content',
    'CType',
    [
        'LLL:EXT:stwm_sitepackage/Resources/Private/Language/locallang_db.xlf:amdsbear_alert.wizard.title',
        'amdsbear_alert',
        'tx_amdsbear_alert'
    ],
    'textmedia',
    'after'
);


/***************
 * Assign Icon
 */

$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['amdsbear_alert'] = 'tx_stwm_alert';


/***************
 * Register fields
 */

$tempColumns = [
    'tx_amdsbear_escalation' =>
        [
            'config' =>
                [
                    'items' =>
                        [
                            [
                                'LLL:EXT:stwm_sitepackage/Resources/Private/Language/locallang_db.xlf:amdsbear_escalation.I.0',
                                'success',
                            ],
                            [
                                'LLL:EXT:stwm_sitepackage/Resources/Private/Language/locallang_db.xlf:amdsbear_escalation.I.1',
                                'danger',
                            ],
                            [
                                'LLL:EXT:stwm_sitepackage/Resources/Private/Language/locallang_db.xlf:amdsbear_escalation.I.2',
                                'warning',
                            ],
                            [
                                'LLL:EXT:stwm_sitepackage/Resources/Private/Language/locallang_db.xlf:amdsbear_escalation.I.3',
                                'info',
                            ],
                        ],
                    'renderType' => 'selectSingle',
                    'type' => 'select',
                ],
            'exclude' => '1',
            'label' => 'LLL:EXT:stwm_sitepackage/Resources/Private/Language/locallang_db.xlf:amdsbear_escalation.label',
        ],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $tempColumns);


$tempTypes = [
    'amdsbear_alert' =>
        [
            'columnsOverrides' =>
                [
                    'bodytext' =>
                        [
                            'config' =>
                                [
                                    'richtextConfiguration' => 'default',
                                    'enableRichtext' => 1,
                                ],
                        ],
                ],
            'showitem' => '
			--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
			--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,header,subheader,bodytext,tx_amdsbear_escalation,
			--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
			--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.appearanceLinks;appearanceLinks,
			--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
			--palette--;;language,
			--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
			--palette--;;hidden,
			--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
			--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,
			--div--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_category.tabs.category,categories,		
			--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended,tx_gridelements_container,tx_gridelements_columns, 
			--div--;LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xlf:gridElements',
        ],
];
$GLOBALS['TCA']['tt_content']['types'] += $tempTypes;
