[TYPO3-dev] Different configs for different types in TCA

Christian Opitz christian.opitz at netzelf.de
Wed Jul 6 17:27:01 CEST 2011


Hi,

I sometimes need to change configs on TCA-columns depending on the type 
that is currently selected (F.i. change labels, items in selects, 
minitems etc.).

Meanwhile I found some hacky ways for some use cases that I rather don't 
show here but I'm curious if there are some "official" ways to do that. 
F.i. I could imagine creating a second column for that I have to change 
sth. with a "extends"-key pointing to the column to override:

'columns' => array (
	'type' => array (		
		'exclude' => 0,		
		'label' => 'type',		
		'config' => array (
			'type' => 'select',
			'items' => array (
				array('company', '1'),
				array('user', '2'),
			),
		)
	),
	'logo' => array (		
		'exclude' => 0,		
		'label' => 'logo',		
		'config' => array (
			'type' => 'group',
			'internal_type' => 'file',
			'uploadfolder' => 'uploads/tx_example/logos',
			// ...
		)
	),
	'avatar' => array (
		'extends' => 'logo',
		'label' => 'avatar',	
		'config' => array (
			'uploadfolder' => 'uploads/tx_example/avatars'
		)
	),
),
'types' => array (
	'1' => array('showitem' => 'logo'),
	'2' => array('showitem' => 'avatar'),
),

Avatar would be recursively merged on 'image' and then be saved to 
db-column "image" too. Do you have a idea on how this could be done?

Best regards,
Christian




More information about the TYPO3-dev mailing list