[TYPO3-english] addTCAcolumns - have one field depend on the other

Bart van den Burg bart at samson-it.nl
Mon Dec 13 14:09:39 CET 2010


Hi

I created a frontend plugin, and need to know two things from the user, 
when he adds it to the page: the type of data to show (JS, List, Detail) 
and the detail page.

I need to know the latter only when the former is set to "List". How can 
I configure the TCA so that it will display this field only when "List" 
is selected?

This is the code so far:

<?php

[...]
t3lib_div::loadTCA('tt_content');

$columnArray = array(
	'tx_excentlocation_view'=>array(
         'exclude'=>0,
         'label'=>'view',
         'config'=>array(
             'type'=>'select',
             'items'=>array(
             	array('JS','JS'),
                 array('List','List'),
                 array('Detail','Detail')
             ),
             'size'=>1,
             'maxitems'=>1
         )
     ),
     'tx_excentlocation_detail_page' => array (
         'exclude' => 0,
         'label' => 'detail page',
         'config' => array (
             'type' => 'group',
             'internal_type' => 'db',
             'allowed' => 'pages',
             'size' => 1,
             'minitems' => 1,
             'maxitems' => 1,
         )
     ),

);

t3lib_extMgm::addTCAcolumns('tt_content', $columnArray, 1);
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY.'_pi1']='layout,select_key,pages';
$TCA["tt_content"]["types"]["list"]["subtypes_addlist"][$_EXTKEY."_pi1"]="tx_excentlocation_view, 
tx_excentlocation_detail_page";

t3lib_extMgm::addPlugin(array(
	'LLL:EXT:excent_location/locallang_db.xml:tt_content.list_type_pi1',
	$_EXTKEY . '_pi1',
	t3lib_extMgm::extRelPath($_EXTKEY) . 'ext_icon.gif'
),'list_type');
?>

Thanks!
Regard,
Bart


More information about the TYPO3-english mailing list