Project

General

Profile

Bug #21594 » t3lib_befunc_getTCAtypes_merged.patch

Administrator Admin, 2010-06-22 15:51

View differences:

class.t3lib_befunc.php (Arbeitskopie)
$typesConf = $TCA[$table]['types'][$fieldValue];
// Get fields list and traverse it
$fieldList = explode(',', $typesConf['showitem']);
$fieldList = t3lib_div::trimExplode(',', $typesConf['showitem'], 1);
$paletteFieldList = array();
$altFieldList = array();
// Change fields list by subtype
$fieldListAdd = array();
$fieldListRemove = array();
if(isset($typesConf['subtype_value_field'])) {
if(isset($typesConf['subtypes_addlist'][$rec[$typesConf['subtype_value_field']]])) {
$fieldListAdd = t3lib_div::trimExplode(',', $typesConf['subtypes_addlist'][$rec[$typesConf['subtype_value_field']]], 1);
if(count($fieldListAdd)) {
$fieldList = array_merge($fieldList, $fieldListAdd);
}
}
if(isset($typesConf['subtypes_excludelist'][$rec[$typesConf['subtype_value_field']]])) {
$fieldListRemove = t3lib_div::trimExplode(',', $typesConf['subtypes_excludelist'][$rec[$typesConf['subtype_value_field']]], 1);
if(count($fieldListRemove)) {
$fieldList = array_diff($fieldList, $fieldListRemove);
}
}
}
// Change fields list by bitmask
$fieldListRemove = array();
if(isset($typesConf['bitmask_value_field']) && is_array($typesConf['bitmask_excludelist_bits'])) {
$bitValue = t3lib_div::intInRange($rec[$typesConf['bitmask_value_field']], 0);
foreach($typesConf['bitmask_excludelist_bits'] as $bitKey => $excludeList) {
$sign=substr($bitKey,0,1);
$bit=substr($bitKey,1);
if (t3lib_div::testInt($bit)) {
$bit = t3lib_div::intInRange($bit, 0, 30);
if (($sign == '-' && !($$bitValue & pow(2, $bit))) || ($sign == '+' && ($$bitValue & pow(2, $bit)))) {
$fieldListRemove = array_merge($fieldListRemove, t3lib_div::trimExplode(',', $excludeList, 1));
}
}
}
if(count($fieldListRemove)) {
$fieldList = array_diff($fieldList, $fieldListRemove);
}
}
// Traverse fields in types config and parse the configuration into a nice array:
foreach($fieldList as $k => $v) {
list($pFieldName, $pAltTitle, $pPalette, $pSpec) = t3lib_div::trimExplode(';', $v);
......
if ($useFieldNameAsKey) {
$altFieldList[$fieldList[$k]['field']] = $fieldList[$k];
}
if ($pPalette && $TCA[$table]['palettes'][$pPalette]) {
$paletteFields = t3lib_div::trimExplode(',', $TCA[$table]['palettes'][$pPalette]['showitem']);
foreach ($paletteFields as $paletteFieldName) {
$paletteFieldList[] = $paletteFieldName;
}
}
}
foreach ($paletteFieldList as $paletteFieldName) {
$defaultExtras = is_array($TCA[$table]['columns'][$paletteFieldName]) ? $TCA[$table]['columns'][$paletteFieldName]['defaultExtras'] : '';
$specConfParts = t3lib_BEfunc::getSpecConfParts('', $defaultExtras);
$addPaletteFieldToFieldList = array (
'field' => $paletteFieldName,
'title' => '',
'palette' => '',
'spec' => $specConfParts,
'origString' => $paletteFieldName
);
if ($useFieldNameAsKey) {
$altFieldList[$paletteFieldName] = $addPaletteFieldToFieldList;
} else {
$fieldList[] = $addPaletteFieldToFieldList;
}
}
if ($useFieldNameAsKey) {
$fieldList = $altFieldList;
}
(3-3/3)