<?php

$ll = 'LLL:EXT:grossmarkt/Resources/Private/Language/locallang_db.xlf:';

$columns = [
	'image_detail' => [
		'exclude' => true,
		'label' => $ll . 'tx_news_domain_model_category.image_detail',
		'config' => [
			'type' => 'file',
			'appearance' => [
				'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference',
				'showPossibleLocalizationRecords' => true,
				'showAllLocalizationLink' => true,
				'showSynchronizationLink' => true,
			],
			'behaviour' => [
				'allowLanguageSynchronization' => true,
			],
			'maxitems' => 1,
			'allowed' => 'common-image-types',
		],
	],
	'purchasing_requirements' => [
		'exclude' => true,
		'label' => $ll . 'tx_news_domain_model_category.purchasing_requirements',
		'config' => [
			'type' => 'text',
			'enableRichtext' => true,
		],
	],
	'opening_hours' => [
		'exclude' => true,
		'label' => $ll . 'tx_news_domain_model_category.opening_hours',
		'config' => [
			'type' => 'text',
			'enableRichtext' => true,
		],
	],
	'parking' => [
		'exclude' => true,
		'label' => $ll . 'tx_news_domain_model_category.parking',
		'config' => [
			'type' => 'text',
			'enableRichtext' => true,
		],
	],
	'delivery_traffic' => [
		'exclude' => true,
		'label' => $ll . 'tx_news_domain_model_category.delivery_traffic',
		'config' => [
			'type' => 'text',
			'enableRichtext' => true,
		],
	],
	'aps' => [
		'exclude' => true,
		'label' => $ll . 'tx_news_domain_model_category.aps',
		'config' => [
			'type' => 'text',
			'enableRichtext' => true,
		],
	],
	'fees' => [
		'exclude' => true,
		'label' => $ll . 'tx_news_domain_model_category.fees',
		'config' => [
			'type' => 'text',
			'enableRichtext' => true,
		],
	],
	'color' => [
		'exclude' => true,
		'label' => $ll . 'tx_news_domain_model_category.color',
		'config' => [
			'type' => 'select',
			'renderType' => 'selectSingle',
			'items' => [
				[
					'label' => 'Without color',
					'value' => '',
				],
				[
					'label' => 'Green',
					'value' => 'green',
				],
				[
					'label' => 'Red',
					'value' => 'red',
				],
				[
					'label' => 'Purple',
					'value' => 'purple',
				],
				[
					'label' => 'Blue',
					'value' => 'blue',
				],
				[
					'label' => 'Yellow',
					'value' => 'yellow',
				],
				[
					'label' => 'White',
					'value' => 'white',
				],
			],
			'behaviour' => [
				'allowLanguageSynchronization' => true,
			],
		],
	],
];

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_category', $columns);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
	'sys_category',
	'color',
	'',
	'after:title'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_category', $columns);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
	'sys_category',
	'image_detail',
	'',
	'after:images'
);

$GLOBALS['TCA']['sys_category']['palettes']['sliderDetails'] = [
	'label' => 'Slider Details',
	'showitem' => 'purchasing_requirements,
	--linebreak--,opening_hours,
	--linebreak--,parking,
	--linebreak--,delivery_traffic,
	--linebreak--,aps,
	--linebreak--,fees,',
];

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
	'sys_category',
	'--div--;'.$ll.'sys_category.tabs.slider'.',--palette--;;sliderDetails,',
);