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

call_user_func(function()
{

    /**
     * Default PageTS for Amadeus BEAR™
     */
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile(
	    'amds_bear',
        'Configuration/PageTS/All.tsconfig',
        'amadeus BEAR™'
    );
});




// Configure new fields:
$fields = array(
    'html_class' => array(
        'label' => 'HTML Class',
        'exclude' => 1,
        'config' => array(
            'type' => 'input',
            'eval' => 'trim,nospace',
            'max' => 255
        ),
    ),
    'pageteaser_linktext' => array(
        'label' => 'Linktext für Pageteaser',
        'exclude' => 1,
        'config' => array(
            'type' => 'input',
            'eval' => 'trim',
            'max' => 255
        ),
    )

);



// Add new fields to pages:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('pages', $fields);

// Make fields visible in the TCEforms:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
    'pages', // Table name
    '--palette--;HTML;amds_bear', // Field list to add
    '', // List of specific types to add the field list to. (If empty, all type entries are affected)
    'after:layout' // Insert fields before (default) or after one, or replace a field
);

// Add the new palette:
$GLOBALS['TCA']['pages']['palettes']['amds_bear'] = array(
    'showitem' => 'html_class'
);


// Make fields visible in the TCEforms:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
    'pages', // Table name
    'pageteaser_linktext', // Field list to add
    '', // List of specific types to add the field list to. (If empty, all type entries are affected)
    'after:subtitle' // Insert fields before (default) or after one, or replace a field
);
