Project

General

Profile

Bug #17889 » bug6896.diff

Administrator Admin, 2008-04-03 23:25

View differences:

t3lib/class.t3lib_tceforms.php (working copy)
if (count($classes)) {
$class = ' class="'.implode(' ',$classes).'"';
} else $class='';
$evalList = t3lib_div::trimExplode(',',$config['eval'],1);
foreach ($evalList as $func) {
switch ($func) {
case 'required':
$this->registerRequiredProperty('field', $table.'_'.$row['uid'].'_'.$field, $PA['itemFormElName']);
break;
default:
if (substr($func, 0, 3) == 'tx_') {
// Pair hook to the one in t3lib_TCEmain::checkValue_input_Eval() and t3lib_TCEmain::checkValue_text_Eval()
$evalObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func].':&'.$func);
if (is_object($evalObj) && method_exists($evalObj, 'deevaluateFieldValue')) {
$_params = array(
'value' => $PA['itemFormElValue']
);
$PA['itemFormElValue'] = $evalObj->deevaluateFieldValue($_params);
}
}
break;
}
}
$iOnChange = implode('',$PA['fieldChangeFunc']);
$item.= '
<textarea name="'.$PA['itemFormElName'].'"'.$formWidthText.$class.' rows="'.$rows.'" wrap="'.$wrap.'" onchange="'.htmlspecialchars($iOnChange).'"'.$PA['onFocus'].'>'.
t3lib/class.t3lib_tcemain.php (working copy)
switch ($tcaFieldConf['type']) {
case 'text':
$res = $this->checkValue_text($res,$value,$tcaFieldConf,$PP,$field);
break;
case 'passthrough':
case 'user':
$res['value'] = $value;
......
return $res;
}
/**
* Evaluate "text" 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
* @param string Field name
* @return array Modified $res array
*/
function checkValue_text($res,$value,$tcaFieldConf,$PP,$field='') {
$evalCodesArray = t3lib_div::trimExplode(',',$tcaFieldConf['eval'],1);
$res = $this->checkValue_text_Eval($value,$evalCodesArray,$tcaFieldConf['is_in']);
return $res;
}
/**
* Evaluate "input" type values.
......
return $value;
}
function checkValue_text_Eval($value,$evalArray,$is_in) {
$res = Array();
$newValue = $value;
$set = true;
foreach ($evalArray as $func) {
switch ($func) {
case 'trim':
$value = trim($value);
break;
case 'required':
if (!$value) {$set=0;}
break;
default:
if (substr($func, 0, 3) == 'tx_') {
$evalObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func].':&'.$func);
if (is_object($evalObj) && method_exists($evalObj, 'evaluateFieldValue')) {
$value = $evalObj->evaluateFieldValue($value, $is_in, $set);
}
}
break;
}
}
if ($set) {$res['value'] = $value;}
return $res;
}
/**
* Evaluation of 'input'-type values based on 'eval' list
*
(1-1/2)