Project

General

Profile

Bug #18036 » bug_7235.diff

Administrator Admin, 2008-01-22 14:51

View differences:

typo3_src/t3lib/class.t3lib_flexformtools.php 2008-01-22 14:17:33.000000000 +0100
* @return string XML content.
*/
function flexArray2Xml($array, $addPrologue=FALSE) {
// Sanity check if the array contains the expected fields. Fix bug #0007235 which creates empty elements in the XML data and non-sequential index keys.
if (is_array($array['data']['sDEF']['lDEF']['fields']['el']) ) {
// Sort the array by key.
ksort($array['data']['sDEF']['lDEF']['fields']['el']);
// Create an array to store the fixed array.
$newarray = array();
// Counter to create incremental array keys.
$counter=1;
// Loop through all values.
foreach ($array['data']['sDEF']['lDEF']['fields']['el'] as $key => $value) {
// Skip empty fields.
if (is_array($value))
// Store the value with the new key
$newarray[$counter++] = $value;
}
// Overwrite the old array with the new array with fixed data.
$array['data']['sDEF']['lDEF']['fields']['el'] = $newarray;
}
$options = $GLOBALS['TYPO3_CONF_VARS']['BE']['niceFlexFormXMLtags'] ? $this->flexArray2Xml_options : array();
$spaceInd = ($GLOBALS['TYPO3_CONF_VARS']['BE']['compactFlexFormXML'] ? -1 : 4);
$output = t3lib_div::array2xml($array,'',0,'T3FlexForms', $spaceInd, $options);
(2-2/2)