Project

General

Profile

Bug #20420 » EditController.patch

René Fritz, 2016-10-25 12:38

View differences:

typo3/sysext/backend/Classes/Controller/Wizard/EditController.php (revision )
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
use TYPO3\CMS\Core\Database\RelationHandler;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\HttpUtility;
......
$field = $this->P['field'];
$config = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
$fTable = $config['foreign_table'];
// If the field is a flexForm field, get the field config from flexform ds
// TODO is there any other more elegant method? The whole flexform handling seems to be a bit hardcoded
if ($this->P['flexFormPath'] && intval($this->P['uid'])) {
// we need the original record to get the right flexform ds
// TODO this will not work with uid 'NEW'
// Unfortunately we can't create a fake record here to get the flexform ds because information like CType etc. is missing here
$row = BackendUtility::getRecord($table, $this->P['uid']);
$dataStructArray = BackendUtility::getFlexFormDS($GLOBALS['TCA'][$table]['columns'][$field]['config'], $row, $table, $field);
// we need the path of the flexform ds, we get it from the flexform data path
$fieldDataPath = explode('/', $this->P['flexFormPath']);
$ffSheet = $fieldDataPath[1];
$ffFieldName = $fieldDataPath[3];
$dsPath = "sheets/{$ffSheet}/ROOT/el/{$ffFieldName}/TCEforms/config";
/** @var FlexFormTools $flexFormTools */
$flexFormTools = GeneralUtility::makeInstance(FlexFormTools::class);
$config = $flexFormTools->getArrayValueByPath(
$dsPath,
$dataStructArray
);
}
$urlParameters = [
'returnUrl' => BackendUtility::getModuleUrl('wizard_edit', ['doClose' => 1])
    (1-1/1)