[TYPO3-dev] itemsProcFunc in checkboxes bug?
Franz Holzinger
franz at fholzinger.com
Tue Jul 18 19:06:04 CEST 2006
Hello Sven,
> then each checkbox is shown in TCEForms, but the values will not be
> processed in correct way.
> I have found that the problem is in t3lib_tcemain::checkValue_check(),
> around line 1224
>
> if ($value>$maxV) {$value=$maxV;}
>
> where $maxV is not correct, because there is no count for $itemC 4 lines
> above.
>
/**
* Evaluates 'check' type values.
*
* @param array The result array. The processed value (if any!) is set
in the 'value' key.
* @param string The value to set.
* @param array Field configuration from TCA
* @param array Additional parameters in a numeric array:
$table,$id,$curValue,$status,$realPid,$recFID
* @return array Modified $res array
*/
function checkValue_check($res,$value,$tcaFieldConf,$PP) {
list($table,$id,$curValue,$status,$realPid,$recFID) = $PP;
$itemC = count($tcaFieldConf['items']);
if (!$itemC) {$itemC=1;}
$maxV = pow(2,$itemC);
if ($value<0) {$value=0;}
if ($value>$maxV) {$value=$maxV;}
$res['value'] = $value;
return $res;
}
In your case $maxV will be 2.
Your tx_myExt_itemsProcFunc->main is called with the parameter $params
array.
$params['items'] = &$items;
So you have to fill out the $items there.
/**
* Perform user processing of the items arrays of checkboxes,
selectorboxes and radio buttons.
*
* @param array The array of items (label,value,icon)
* @param array The "itemsProcFunc." from fieldTSconfig of the field.
* @param array The config array for the field.
* @param string Table name
* @param array Record row
* @param string Field name
* @return array The modified $items array
*/
function procItems($items,$iArray,$config,$table,$row,$field) {
global $TCA;
$params=array();
$params['items'] = &$items;
$params['config'] = $config;
$params['TSconfig'] = $iArray;
$params['table'] = $table;
$params['row'] = $row;
$params['field'] = $field;
t3lib_div::callUserFunction($config['itemsProcFunc'],$params,$this);
return $items;
}
- Franz
More information about the TYPO3-dev
mailing list