[TYPO3-dev] new TCA field but only if a specific plugin is choosen

Krystian Szymukowicz t33k at prolabium.com
Sun Mar 27 13:16:45 CEST 2011


W dniu 2011-03-27 12:44, Krystian Szymukowicz wrote:
>
> Hello
>
> I wonder if you know a way to show a new TCA field but only if a
> specific plugin is choosen.


I found a quite simple solution using the hook "getMainFieldsClass".

In ext_tables.php you add the field as usuall but you do not use 
"t3lib_extMgm::addToAllTCAtypes". You use that function in the hook if 
the condition is met.




Details for interesting:



Declare hook in localconf.php

$GLOBALS 
['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass'][] 
= 
'EXT:multiteaer/Classes/Hooks/class.tx_multiteaser_tceforms.php:tx_multiteaser_tceforms';




In Classes/Hooks/class.tx_multiteaser_tceforms.php:tx_multiteaser_tceforms

class tx_multiteaser_tceforms {

	function getMainFields_preProcess($table, $row, $caller) {
	
		if($row['list_type'] == 'multiteaser_pi1') {
		 
t3lib_extMgm::addToAllTCAtypes('tt_content','--div--;LLL:EXT:multiteaser/Resources/Private/Languages/locallang_db.xml:tx_multiteaser.teaser_tab,tx_multiteaser_activate_teaser, 
tx_multiteaser');
		}
		
	}
	
}


-- 
grtz
Krystian Szymukowicz




More information about the TYPO3-dev mailing list