[BUGFIX] Fix calls to undefined methods in FormDataTraverser 66/43166/6
authorChristian Kuhn <lolli@schwarzbu.ch>
Thu, 10 Sep 2015 09:52:40 +0000 (11:52 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 10 Sep 2015 10:43:38 +0000 (12:43 +0200)
Resolves: #69634
Releases: master
Change-Id: I83b0d96b200b118f7b81b8f28ffbc76efd2620f8
Reviewed-on: http://review.typo3.org/43166
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Classes/Form/FormDataTraverser.php

index f960ed3..ef5109f 100644 (file)
@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Backend\Form;
  */
 
 use TYPO3\CMS\Backend\Form\FormDataGroup\TcaDatabaseRecord;
-use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
@@ -187,8 +186,6 @@ class FormDataTraverser {
                $possibleUidsCount = count($possibleUids);
                if ($possibleUidsCount === 1) {
                        $relatedRow = $this->getRecordRow($possibleUids[0]);
-               } elseif ($possibleUidsCount > 1) {
-                       $relatedRow = $this->getMatchingRecordRowByTranslation($possibleUids, $fieldConfig);
                }
 
                return $relatedRow;
@@ -365,11 +362,22 @@ class FormDataTraverser {
                        $fieldConfig['foreign_table_where'] .= ' AND ' . $fieldConfig['foreign_table'] . '.uid IN (' . $value . ')';
                }
 
-               $PA = array();
-               $PA['fieldConf']['config'] = $fieldConfig;
-               $PA['fieldTSConfig'] = FormEngineUtility::getTSconfigForTableRow($this->currentTable, $this->currentRow, $fieldName);
-               $PA['fieldConf']['config'] = FormEngineUtility::overrideFieldConf($PA['fieldConf']['config'], $PA['fieldTSConfig']);
-               $selectItemArray = FormEngineUtility::getSelectItems($this->currentTable, $fieldName, $this->currentRow, $PA);
+               /** @var TcaDatabaseRecord $formDataGroup */
+               $formDataGroup = GeneralUtility::makeInstance(TcaDatabaseRecord::class);
+               /** @var FormDataCompiler $formDataCompiler */
+               $formDataCompiler = GeneralUtility::makeInstance(FormDataCompiler::class, $formDataGroup);
+               $formDataInput = [
+                       'vanillaUid' => (int)$this->currentRow['uid'],
+                       'tableName' => $this->currentTable,
+                       'command' => 'edit',
+               ];
+               $formDataResult = $formDataCompiler->compile($formDataInput);
+               $selectItemArray = [];
+               if (isset($formDataResult['processedTca']['columns'][$fieldName]['config']['items'])
+                       && is_array($formDataResult['processedTca']['columns'][$fieldName]['config']['items'])
+               ) {
+                       $selectItemArray = $formDataResult['processedTca']['columns'][$fieldName]['config']['items'];
+               }
 
                if ($isTraversable && !empty($selectItemArray)) {
                        $this->currentTable = $fieldConfig['foreign_table'];