[TYPO3-english] TCA conditional selects

MantasK programuotojas at gmail.com
Mon Mar 15 11:42:15 CET 2010


Thanks to all! Information helped me very much to understand how tca 
works. Of course there is a lot of space for improvement.

I have one more question about itemsProcFunc. Oliver does you code work 
well with translations? Because when I change selected item in default 
language in translated one is shown:
"Changed in original translation:"
At the bottom of it there supposed to be original text, but it isn't. If 
I add foreign_table it shows up, but text isn't that which is formated 
in itemsProcFunc.

Thank you.

Mantas

On 2010.03.04 18:07, Oliver Klee wrote:
>
> tca.php:
>
> 'district' =>  array(
> 	'displayCond' =>  'FIELD:city:>:0',
> 	'exclude' =>  0,
> 	'label' =>  'LLL:EXT:realty/locallang_db.xml:tx_realty_objects.district',
> 	'config' =>  array(
> 		'type' =>  'select',
> 		'itemsProcFunc' =>  'tx_realty_Tca->getDistrictsForCity',
> ...
>
>
> tx_realty_Tca::
>
> /**
>   * Gets the districts for a certain city.
>   *
>   * @param array $data the TCEforms data, must at least contain [row][city]
>   *
>   * @return array the TCEforms data with the districts added
>   */
> public function getDistrictsForCity(array $data) {
> 	$items = array(array('', 0));
>
> 	$districs = tx_oelib_MapperRegistry::get('tx_realty_Mapper_District')
> 	->findAllByCityUidOrUnassigned($data['row']['city']);
> 	foreach ($districs as $district) {
> 		$items[] = array($district->getTitle(), $district->getUid());
> 	}
>
> 	$data['items'] = $items;
>
> 	return $data;
> }
>
>
> Oli



More information about the TYPO3-english mailing list