Feature #17745 » 6635_class.t3lib_transferdata.patch
class.t3lib_transferdata.php (working copy) | ||
---|---|---|
// Default values as set in userTS:
|
||
$TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
|
||
if (is_array($TCAdefaultOverride[$table.'.'])) {
|
||
foreach($TCAdefaultOverride[$table.'.'] as $theF => $theV) {
|
||
// Default values as set in pageTS
|
||
$pageTS = t3lib_beFunc::getPagesTSconfig($id, true);
|
||
$pageTS = (isset($pageTS['TCAdefaults.'])) ? $pageTS['TCAdefaults.'] : array();
|
||
// Merge userTS and pageTS; pageTS overrules userTS
|
||
$TSconfig = t3lib_div::array_merge_recursive_overrule($TCAdefaultOverride,$pageTS);
|
||
if (is_array($TSconfig[$table.'.'])) {
|
||
foreach($TSconfig[$table.'.'] as $theF => $theV) {
|
||
if (isset($TCA[$table]['columns'][$theF])) {
|
||
$newRow[$theF]=$theV;
|
||
}
|
||
}
|
||
}
|
||
// FEATURE ct 2007-11-02 Allow userFuncs in TCAdefaults, see issue #6635 for details
|
||
if (is_array($theV)) {
|
||
$theF = substr($theF, 0, -1); // Remove trailing dot from fieldname
|
||
$funcName = $theV['userFunc'];
|
||
$params = Array(
|
||
'table' => $table,
|
||
'field' => $theF,
|
||
'value' => $newRow[$theF],
|
||
'conf' => $theV['userFunc.']
|
||
);
|
||
$pageTS = t3lib_beFunc::getPagesTSconfig($id, true);
|
||
if (isset($pageTS['TCAdefaults.'])) {
|
||
$TCAPageTSOverride = $pageTS['TCAdefaults.'];
|
||
if (is_array($TCAPageTSOverride[$table.'.'])) {
|
||
foreach($TCAPageTSOverride[$table.'.'] as $theF => $theV) {
|
||
if (isset($TCA[$table]['columns'][$theF])) {
|
||
$newRow[$theF]=$theV;
|
||
}
|
||
$newRow[$theF] = t3lib_div::callUserFunction($funcName, $params, $this);
|
||
}
|
||
}
|
||
}
|