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

call_user_func( function () {
	/**
	 * Default PageTS for stwmue_sitepackage
	 */
	\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile(
		'stwmue_sitepackage',
		'Configuration/PageTS/All.tsconfig',
		'Template Stadtwerke Münchberg'
	);
} );

// 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;stwmue_sitepackage', // 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
);
