<?php
return [
    'ctrl' => [
        'title'	=> 'LLL:EXT:products/Resources/Private/Language/locallang.xlf:tx_products_domain_model_productgroup',
        'label' => 'name',
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'default_sortby' => 'name',
		'versioningWS' => true,
        'languageField' => 'sys_language_uid',
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
		'delete' => 'deleted',
		'enablecolumns' => [
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
        ],
		'searchFields' => 'name',
        'iconfile' => 'EXT:products/Resources/Public/Icons/tx_products_domain_model_productgroup.svg'
    ],
    'types' => array(
        '1' => array('showitem' => '
            --div--;Allgemein,
                --palette--;Produktgruppe;palettes_productgroup,
                --palette--;Sachmerkmals-Leisten;palettes_propertygroups,
            --div--;Bilder und Videos,
                --palette--;Bilder;palettes_images,
                --palette--;Videos;palettes_videos,
            --div--;Merkmale,
                --palette--;Merkmale;palettes_properties,
            --div--;Downloads,
                --palette--;Downloads;palettes_downloads,
            --div--;Produktvarianten,
                --palette--;Produktvarianten;palettes_products,
            --div--;Verknüpfungen,
                --palette--;Verknüpfungen;palettes_relations,
            --div--;Zugriff,
                --palette--;Sichtbarkeit;palettes_visibility,
                --palette--;Zugriff;palettes_access,
            --div--;Video,
                --palette--;Video;palettes_video'),
    ),
    'palettes' => array(
        'palettes_productgroup' => array(
            'showitem' => 'name, --linebreak--, weight_min, weight_max, --linebreak--, short, --linebreak--, description, --linebreak--, image',
            'canNotCollapse' => 1
        ),
        'palettes_products' => array(
            'showitem' => 'products, --linebreak--, productclasses',
            'canNotCollapse' => 1
        ),
        'palettes_video' => array(
            'showitem' => 'video',
            'canNotCollapse' => 1
        ),
        'palettes_propertygroups' => array(
            'showitem' => 'propertygroups',
            'canNotCollapse' => 1
        ),
//        'palettes_properties' => array(
//            'showitem' => 'pi_flexform',
//            'canNotCollapse' => 1
//        ),
        'palettes_relations' => array(
            'showitem' => 'accessories, --linebreak--, accessoryvariants, --linebreak--, related, --linebreak--, faq',
            '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'],
        ],
		'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)
                ]
            ],
        ],
	    'name' => [
	        'exclude' => true,
	        'label' => 'LLL:EXT:products/Resources/Private/Language/locallang.xlf:tx_products_domain_model_productgroup.name',
	        'config' => [
			    'type' => 'input',
			    'size' => 30,
			    'eval' => 'trim'
			],
	    ],
        'subtitle' => [
           'exclude' => true,
           'label' => 'Untertitel',
           'config' => [
               'type' => 'input',
               'size' => 30,
               'eval' => 'trim'
           ],
        ],
        'weight_min' => [
            'exclude' => true,
            'label' => 'Einsatzgewicht (min in kg)',
            'config' => [
                'type' => 'number',
                'size' => 10,
                'eval' => 'trim',
                'format' => 'decimal'
            ]
        ],
        'weight_max' => [
            'exclude' => true,
            'label' => 'Einsatzgewicht (max in kg)',
            'config' => [
                'type' => 'number',
                'size' => 10,
                'eval' => 'trim',
                'format' => 'decimal'
            ]
        ],
        'products' => array(
            'exclude' => 1,
            'label' => 'LLL:EXT:products/Resources/Private/Language/locallang.xlf:tx_products_domain_model_product',
            'config' => array(
                'type' => 'inline',
                'foreign_table' => 'tx_products_domain_model_product',
                'foreign_field' => 'productgroup',
                'foreign_sortby' => 'sorting',
                'appearance' => [
                   'useSortable' => TRUE,
                   'showPossibleLocalizationRecords' => TRUE,
                   'showSynchronizationLink' => TRUE,
                   'showAllLocalizationLink' => TRUE,

                   'enabledControls' => [
                       'info' => FALSE,
                       'new' => TRUE,
                       'dragdrop' => TRUE,
                       'sort' => TRUE,
                       'hide' => TRUE,
                       'delete' => TRUE,
                       'localize' => TRUE,
                   ],
               ],
               'behaviour' => [
                   'localizeChildrenAtParentLocalization' => TRUE,
               ],
            ),
        ),
        'productclasses' => array(
            'exclude' => 1,
            'label' => 'Klassifizierungen für Varianten',
            'config' => array(
                'type' => 'inline',
                'foreign_table' => 'tx_products_domain_model_productclass',
                'foreign_field' => 'productgroup',
                'foreign_sortby' => 'sorting',
                'appearance' => [
                   'useSortable' => TRUE,
                   'showPossibleLocalizationRecords' => TRUE,
                   'showSynchronizationLink' => TRUE,
                   'showAllLocalizationLink' => TRUE,

                   'enabledControls' => [
                       'info' => FALSE,
                       'new' => TRUE,
                       'dragdrop' => TRUE,
                       'sort' => TRUE,
                       'hide' => TRUE,
                       'delete' => TRUE,
                       'localize' => TRUE,
                   ],
               ],
               'behaviour' => [
                   'localizeChildrenAtParentLocalization' => TRUE,
               ],
            ),
        ),
        'propertygroups' => array(
            'exclude' => 1,
            'label' => 'LLL:EXT:products/Resources/Private/Language/locallang.xlf:tx_products_domain_model_propertygroup',
            'config' => array(
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'tx_products_domain_model_propertygroup',
                'MM' => 'tx_products_productgroup_propertygroup_mm',
                'maxitems' => 99999,
                'minitems' => 0
            ),
        ),
        'pi_flexform' => [
            'exclude' => 1,
            'label' => '',
            'config' => [
                'type' => 'flex',
                'ds' => [
                    'default' => '<T3DataStructure><ROOT><el></el></ROOT></T3DataStructure>'
                ]
            ]
        ],
        'image' => array(
			'exclude' => 1,
			'label' => 'Produktbild',
			'config' => [
       ### !!! Watch out for fieldName different from columnName
       'type' => 'file',
       'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
       'maxitems' => 1,
   ],
		),
        'short' => [
	        'exclude' => true,
	        'label' => 'Kurzbeschreibung',
	        'config' => [
			    'type' => 'text',
                'cols' => 40,
				'rows' => 3,
			    'eval' => 'trim'
			],
	    ],
        'description' => [
	        'exclude' => true,
	        'label' => 'Beschreibung',
	        'config' => [
			    'type' => 'text',
                'cols' => 40,
				'rows' => 5,
			    'eval' => 'trim',
                'enableRichtext' => true
			],
	    ],
        'accessories' => array(
            'exclude' => 1,
            'label' => 'Zubehör',
            'config' => array(
                'type' => 'group',
                'allowed' => 'tx_products_domain_model_productgroup',
                'foreign_table' => 'tx_products_domain_model_productgroup',
                'MM' => 'tx_products_productgroup_accessory_mm',
                'maxitems' => 99999,
                'minitems' => 0,
                'multiple' => 1,
            ),
        ),
        'accessoryvariants' => array(
            'exclude' => 1,
            'label' => 'Zubehör (Varianten)',
            'config' => array(
                'type' => 'group',
                'allowed' => 'tx_products_domain_model_product',
                'foreign_table' => 'tx_products_domain_model_product',
                'MM' => 'tx_products_productgroup_accessoryvariant_mm',
                'maxitems' => 99999,
                'minitems' => 0,
                'multiple' => 1,
            ),
        ),
        'related' => array(
            'exclude' => 1,
            'label' => 'Ähnliche Produkte',
            'config' => array(
                'type' => 'group',
                'allowed' => 'tx_products_domain_model_productgroup',
                'foreign_table' => 'tx_products_domain_model_productgroup',
                'MM' => 'tx_products_productgroup_related_mm',
                'maxitems' => 99999,
                'minitems' => 0,
                'multiple' => 1,
            ),
        ),
        'news' => array(
			'exclude' => 1,
			'label' => 'News',
			'config' => [
	            'type' => 'group',
	            'allowed' => 'tx_news_domain_model_news',
	            'MM' => 'tx_products_productgroup_news_mm',
	            'foreign_table' => 'tx_news_domain_model_news',
	            'size' => 10,
	            'autoSizeMax' => 20,
	            'minitems' => 0,
	            'maxitems' => 99,
	        ],
		),
        'faq' => [
            'exclude' => 1,
            'label' => 'FAQ',
            'config' => [
                'type' => 'group',
                'allowed' => 'tx_products_domain_model_faq',
                'MM' => 'tx_products_faq_productgroup_mm',
                'MM_opposite_field' => 'productgroup',
                'foreign_table' => 'tx_products_domain_model_faq',
                'foreign_table_where' => 'sys_language_uid = 0',
                'size' => 10,
                'autoSizeMax' => 20,
                'minitems' => 0,
                'maxitems' => 99999,
            ],
        ],
        'video' => [
            'label' => 'Video (Desktop Optimiert)',
            'config' => [
                ### !!! Watch out for fieldName different from columnName
                'type' => 'file',
                'allowed' => 'mp4',
                'minitems' => 0,
                'maxitems' => 1,
                'foreign_match_fields' => [
                    'fieldname' => 'video'
                ],
                'appearance' => [
                    'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
                ],
                // custom configuration for displaying fields in the overlay/reference table
                // to use the imageoverlayPalette instead of the basicoverlayPalette
                'overrideChildTca' => [
                    'types' => [
                        \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
                            'showitem' => '
                                --palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.videoOverlayPalette;videoOverlayPalette,
                                --palette--;;filePalette'
                        ],
                    ],
                ],
            ]
        ],
        
        'video_mobile' => [
            'label' => 'Video (Mobil Optimiert)',
            'config' => [
                ### !!! Watch out for fieldName different from columnName
                'type' => 'file',
                'allowed' => 'mp4',
                'minitems' => 0,
                'maxitems' => 1,
                'foreign_match_fields' => [
                    'fieldname' => 'video_mobile'
                ],
                'appearance' => [
                    'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
                ],
                // custom configuration for displaying fields in the overlay/reference table
                // to use the imageoverlayPalette instead of the basicoverlayPalette
                'overrideChildTca' => [
                    'types' => [
                        \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
                            'showitem' => '
                                --palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.videoOverlayPalette;videoOverlayPalette,
                                --palette--;;filePalette'
                        ],
                    ],
                ],
            ]
        ],
    ],
];
