Even if it's not the best way, I post the changed and tested code instead of a diff-file. I rearranged the inquiries because else the inquiries with "*" are omited. I tested only with two strings and never with "*" or one string for $pointerFields:
public static function getFlexFormDS($conf, $row, $table, $fieldName = '', $WSOL = TRUE, $newRecordPidValue = 0) {
global $TYPO3_CONF_VARS;
// Get pointer field etc from TCA-config:
$ds_pointerField = $conf['ds_pointerField'];
$ds_array = $conf['ds'];
$ds_tableField = $conf['ds_tableField'];
$ds_searchParentField = $conf['ds_pointerField_searchParent'];
// Find source value:
$dataStructArray = '';
if (is_array($ds_array)) { // If there is a data source array, that takes precedence
// If a pointer field is set, take the value from that field in the $row array and use as key.
if ($ds_pointerField) {
// Up to two pointer fields can be specified in a comma separated list.
$pointerFields = t3lib_div::trimExplode(',', $ds_pointerField);
// If we have two pointer fields, the array keys should contain both field values separated by comma. The asterisk "*" catches all values.
// For backwards compatibility, it's also possible to specify only the value of the first defined ds_pointerField.
if(count($pointerFields) 2) {
// Check if we have a DS for the value of the first pointer field suffixed with ",*"
if($ds_pointerField $pointerFields[0].',*') {
$srcPointer = $row[$pointerFields[0]].',*';
}
// Check if we have a DS for the value of the second pointer field prefixed with "*,"
elseif($ds_pointerField == '*,'.$pointerFields[1]) {
$srcPointer = '*';
if ($pointerFields[1]) $srcPointer .= ','.$row[$pointerFields[1]];
else $srcPointer .= ',list';
}
// Check if we have a DS for the combination of both pointer fields values
elseif($ds_pointerField == $pointerFields[0].','.$pointerFields[1]) {
$srcPointer = $row[$pointerFields[0]];
if ($row[$pointerFields[1]]) $srcPointer .= ','.$row[$pointerFields[1]];
else $srcPointer .= ',list';
}
// Check if we have a DS for just the value of the first pointer field (mainly for backwards compatibility)
elseif($pointerFields[0]) {
$srcPointer = $row[$pointerFields[0]];
}
} else {
$srcPointer = $row[$pointerFields[0]];
}
$srcPointer = isset($ds_array[$srcPointer]) ? $srcPointer : 'default';
} else $srcPointer = 'default';
[....]