<?php
return [
    'ctrl' => [
        'title'	=> 'Frage und Antwort',
        'label' => 'question',
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
		'versioningWS' => true,
        'languageField' => 'sys_language_uid',
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
		'delete' => 'deleted',
		'enablecolumns' => [
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
        ],
		'searchFields' => 'question',
        'iconfile' => 'EXT:products/Resources/Public/Icons/tx_products_domain_model_faq.svg'
    ],
    'types' => array(
        '1' => array('showitem' => '
            --div--;Allgemein,
                --palette--;Frage und Antwort;palettes_faq,
            --div--;Zugriff,
                --palette--;Sichtbarkeit;palettes_visibility,
                --palette--;Zugriff;palettes_access'),
    ),
    'palettes' => array(
        'palettes_faq' => array(
            'showitem' => 'question, --linebreak--, tt_content, --linebreak--, productgroup',
            'canNotCollapse' => 1
        ),
        'palettes_visibility' => array(
            'showitem' => 'hidden, sys_language_uid',
            'canNotCollapse' => 1
        ),
        'palettes_access' => array(
            'showitem' => 'starttime, endtime',
            'canNotCollapse' => 1
        ),
    ),
    'columns' => [
		'sys_language_uid' => [
			'exclude' => true,
			'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
			'config' => ['type' => 'language'],
        ],
        'l10n_parent' => [
            'displayCond' => 'FIELD:sys_language_uid:>:0',
            'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    ['label' => '', 'value' => 0],
                ],
                'foreign_table' => 'tx_products_domain_model_faq',
                'foreign_table_where' => 'AND tx_products_domain_model_faq.pid=###CURRENT_PID### AND tx_products_domain_model_faq.sys_language_uid IN (-1,0)',
            ],
        ],
        'l10n_diffsource' => [
            'config' => [
                'type' => 'passthrough',
            ],
        ],
		't3ver_label' => [
            'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
            'config' => [
                'type' => 'input',
                'size' => 30,
                'max' => 255,
            ],
        ],
		'hidden' => [
            'exclude' => true,
            'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
            'config' => [
                'type' => 'check',
                'items' => [
                    '1' => [
                        'label' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled'
                    ]
                ],
            ],
        ],
		'starttime' => [
            'exclude' => true,
            'l10n_mode' => 'mergeIfNotBlank',
            'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
            'config' => [
                'type' => 'input',
                'size' => 13,
                'eval' => 'datetime',
                'default' => 0,
            ]
        ],
        'endtime' => [
            'exclude' => true,
            'l10n_mode' => 'mergeIfNotBlank',
            'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
            'config' => [
                'type' => 'input',
                'size' => 13,
                'eval' => 'datetime',
                'default' => 0,
                'range' => [
                    'upper' => mktime(0, 0, 0, 1, 1, 2038)
                ]
            ],
        ],
        'question' => [
	        'exclude' => true,
	        'label' => 'Frage',
	        'config' => [
			    'type' => 'input',
			    'size' => 60,
			    'eval' => 'trim'
			],
	    ],
        'tt_content' => array(
			'exclude' => 1,
			'label' => 'Antwort',
			'config' => [
		        'type' => 'inline',
		        'allowed' => 'tt_content',
		        'foreign_table' => 'tt_content',
		        'foreign_sortby' => 'sorting',
		        'foreign_field' => 'tx_products_domain_model_faq',
		        'minitems' => 0,
		        'maxitems' => 99,
		        'appearance' => [
		            'collapseAll' => 1,
		            'expandSingle' => 1,
		            'levelLinksPosition' => 'bottom',
		            'useSortable' => 1,
		            'showPossibleLocalizationRecords' => 1,
		            'showAllLocalizationLink' => 1,
		            'showSynchronizationLink' => 1,
					'newRecordLinkTitle' => 'Neue Antwort einfügen',
		            'enabledControls' => [
		                'info' => false,
		            ]
		        ]
		    ]
		),
        'productgroup' => array(
            'exclude' => 1,
            'label' => 'LLL:EXT:products/Resources/Private/Language/locallang.xlf:tx_products_domain_model_productgroup',
            'config' => array(
                'type' => 'group',
                'allowed' => 'tx_products_domain_model_productgroup',
                'foreign_table' => 'tx_products_domain_model_productgroup',
                'foreign_table_where' => 'sys_language_uid = 0',
                'MM' => 'tx_products_faq_productgroup_mm',
                'maxitems' => 99999,
                'minitems' => 0,
                'multiple' => 1,
            ),
        ),
    ],
];
