[TYPO3-dev] Alter foreign_table_where to select items from parent page
Mathias Schreiber [TYPO3]
mathias at typo3.org
Tue Apr 24 15:41:23 CEST 2007
Brian Bendtsen schrieb:
> Mathias Schreiber [TYPO3] skrev:
>> Brian Bendtsen schrieb:
>>> function main() {
>>> $retVal =
>>> array(array('0'=>'value_to_save_in_db','1'=>'label_to_show_in_BE'));
>>> return $retVal;
>>> }
>>> }
>>>
>>> But nothing shows up in the select box.
>>>
>>> I have this in my TCA:
>>
>> Try prefixing the function with user_ or tx_
> No change
>
> Do I have to return an array in an array
>
> Cant it just be:
>
> $retVal = array('0'=>'value_to_save_in_db','1'=>'label_to_show_in_BE');
> return $retVal;
This is, what I do:
function user_getTCAFields($params) {
// Get XML from Flexform and transform it to a PHP array
$flexData = t3lib_div::xml2array($params['row']['pi_flexform']);
// Extract Tablenabe
$table = $flexData['data']['sDEF']['lDEF']['tcatable']['vDEF'];
// Load the TCA for the Selected Table
$localTCA = t3lib_div::loadTCA($table);
$i = 1;
foreach ($GLOBALS['TCA'][$table]['columns'] as $key => $value) {
if (!t3lib_div::inList($this->blackList,$key)) {
$params['items'][$i] = array(
'0' => $key,
'1' => $key
);
$i++;
}
}
return $params['items'];
}
Good thing to know:
I append to the $params['items'] array since some values are defined
in TCA prior to the method call.
More information about the TYPO3-dev
mailing list