Bug #50785 ยป class.t3lib_tceform.php_forge-50785.patch

View differences:

t3lib/class.t3lib_tceforms.php~forge-50787 2013-08-09 18:02:04.000000000 +0200
1414 1414
		$specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']);
1415 1415

  
1416 1416
			// Getting the selector box items from the system
1417
		$selItems = $this->addSelectOptionsToItemArray(
1418
			$this->initItemArray($PA['fieldConf']),
1419
			$PA['fieldConf'],
1420
			$this->setTSconfig($table, $row),
1421
			$field
1422
		);
1417

  
1418
            // Patch to implement FlexForms being accessible using _THIS_ROW (f.e. ###REC_FIELD_ in foreign_table_where)
1419
            // Gabriel Kaufmann <info@typoworx.de>
1420

  
1421
        $TSconfig = $this->setTSconfig($table, $row);
1422
        if($this->dataStructParent=='flex') {
1423
                // Parse FlexForm-Data to one-dimensional Array
1424
            $lDEF = 'lDEF';
1425
            if(
1426
               $GLOBALS['TSFE']->config['config']['sys_language_uid']>0 &&
1427
               !empty($GLOBALS['TSFE']->config['config']['language'])
1428
            ) {
1429
                $lDEF = strtoupper($GLOBALS['TSFE']->config['config']['language']);
1430
            }
1431

  
1432
            $flexArr = null;
1433
            if( ($flexArr = t3lib_div::xml2array($row[ $field ])) ) {
1434
                $flexArr = current($flexArr['data']);
1435
                $flexArr = isset($flexArr[ $lDEF ]) ? $flexArr[ $lDEF ] : $flexArr['lDEF'];
1436
                foreach($flexArr as $k => $v) {
1437
                    $TSconfig['_THIS_ROW'][ $field.'.'.$k ] = current($v);
1438
                }
1439
            }
1440

  
1441
            if($config['type']=='select' || $config['group']) {
1442
                $TSconfig['_THIS_ROW'][ $field.'.'.$k ] = current(t3lib_div::trimExplode('|', $TSconfig['_THIS_ROW'][ $field.'.'.$k ], 1));
1443
            }
1444
        }
1445

  
1446
        $selItems = $this->addSelectOptionsToItemArray(
1447
            $this->initItemArray($PA['fieldConf']),
1448
            $PA['fieldConf'],
1449
            $TSconfig,
1450
            $field
1451
        );
1452

  
1423 1453
			// Possibly filter some items:
1424 1454
		$keepItemsFunc = create_function('$value', 'return $value[1];');
1425 1455
		$selItems = t3lib_div::keepItemsInArray($selItems, $PA['fieldTSConfig']['keepItems'], $keepItemsFunc);
......
2685 2715

  
2686 2716
			// Data Structure array must be ... and array of course...
2687 2717
		if (is_array($dataStruct)) {
2718

  
2719
                // Set this flag to let sub-processing know if we are in FlexForm-processing
2720
                // Gabriel Kaufmann <info@typoworx.de>
2721
            $this->dataStructParent = 'flex';
2722

  
2688 2723
			foreach ($dataStruct as $key => $value) { // Traversing fields in structure:
2689 2724
				if (is_array($value)) { // The value of each entry must be an array.
2690 2725

  
......
2986 3021
				}
2987 3022
			}
2988 3023
		}
3024
            // Reset flag after leaving FlexForm-processing
3025
            // Gabriel Kaufmann <info@typoworx.de>
3026
        $this->dataStructParent = '';
2989 3027

  
2990 3028
		return $output;
2991 3029
	}
    (1-1/1)