<?php
/**
 * Created by PhpStorm.
 * User: bbaer
 * Date: 5/3/19
 * Time: 6:33 PM
 */

/*
 * The type name is generated by combining the extension key and plugin name, all lowercase and concatenated with `_'
 */

if (!defined('TYPO3_MODE')) {
    die ('Access denied.');
}

if (is_array($GLOBALS['TCA']['tt_content']['palettes'])) {
    $GLOBALS['TCA']['tt_content']['palettes']['introheader']['showitem'] = 'header, subheader, CType';
    $GLOBALS['TCA']['tt_content']['palettes']['startendtime']['showitem'] = 'starttime, endtime';
    $GLOBALS['TCA']['tt_content']['palettes']['layoutpalette1']['showitem'] = 'colPos, header_position, sys_language_uid';
    $GLOBALS['TCA']['tt_content']['palettes']['layoutpalette2']['showitem'] = 'layout, header_layout';
    $GLOBALS['TCA']['tt_content']['palettes']['spacearound']['showitem'] = 'spaceBefore, spaceAfter';
}

if (is_array($GLOBALS['TCA']['tt_content']['types'])) {
    $GLOBALS['TCA']['tt_content']['types']['qfq_qfq'] = array(
        'showitem' => '
        --div--;General,
          --palette--;;introheader,
          custom,
          bodytext;Code:;;nowrap,
        --div--;Access,
          hidden, fe_group, deleted, --palette--;;startendtime,
        --div--;Appearance,
          --palette--;;layoutpalette1,
          --palette--;;layoutpalette2,
          --palette--;;spacearound,
          linkToTop, section_frame, sectionIndex,
        --div--;Language,
          sys_language_uid, l18n_parent, l18n_diffsource',
        'columnsOverrides' => [
            'bodytext' => [
                'config' => [
                    'renderType' => 't3editor',
                    'format' => 'qfq',
                    'rows' => 100
                ],
                'constants' => [
                    'renderType' => 't3editor',
                    'format' => 'qfq',
                ]
            ]
        ]
    );
    $version = \TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version();
    $versionNr = explode('.', $version);
    if ($versionNr[0] < 9) {

        $GLOBALS['TCA']['tt_content']['types']['qfq_qfq']['columnsOverrides']['bodytext']['config']['format'] = 'sparql';
        $GLOBALS['TCA']['tt_content']['types']['qfq_qfq']['columnsOverrides']['bodytext']['constants']['format'] = 'sparql';
    }
}


