[TYPO3-dev] TCA config "itemsProcFunc"

Jonathan jcstpierre at tc2l.ca
Thu Jun 29 13:41:41 CEST 2006


Hi,

I have a problem with the "itemsProcFunc" fonction of the config part in 
the TCA. here is my code...
I can't get the selected items to be shown in the selected section, when 
I try to reedit a record.

		"genre" => Array (		
			"exclude" => 1,
			"label" => "LLL:EXT:locallang_db.xml:manifestations.genre",	
			"config" => Array (
				"type" => "select",
				"itemsProcFunc" => "user_GetGenreItems",
				"size" => 10,
				"minitems" => 0,
				"maxitems" => 99,
			)
		),

function user_GetGenreItems (&$config, &$item) {
	$i=0;
	$res = 
$GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,genre','tx_manifestations_genres','sousgenres=0 
AND deleted=0 AND hidden=0','','genre');
	while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
		$genres[$i]['uid'] = $row['uid'];
		$genres[$i]['genre'] = $row['genre'];
		$i++;
	}
	$i=0;
	$res = 
$GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,genre,sousgenres','tx_manifestations_genres','sousgenres>0 
AND deleted=0 AND hidden=0','','genre');
	while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
		$sousgenres[$i]['uid'] = $row['uid'];
		$sousgenres[$i]['genre'] = $row['genre'];
		$sousgenres[$i]['sousgenres'] = $row['sousgenres'];
		$i++;
	}

	for ($i=0; $i<count($genres); $i++) {
		$config['items'][] = array($genres[$i]['genre'], $genres[$i]['uid']);
		for ($j=0; $j<count($sousgenres); $j++) {
			if ($sousgenres[$j]['sousgenres'] == $genres[$i]['uid']) {
				$config['items'][] = array('- '.$sousgenres[$j]['genre'], 
$sousgenres[$j]['uid']);
			}
		}
	}
	return $config;
}

Thanks
Jonathan




More information about the TYPO3-dev mailing list