[TASK] Flexform support for type:passthrough 91/47491/15
authorFrank Naegler <frank.naegler@typo3.org>
Fri, 1 Apr 2016 14:05:31 +0000 (16:05 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 29 Sep 2017 13:28:06 +0000 (15:28 +0200)
Resolves: #20705
Releases: master
Change-Id: I3476f6945b645a3b906e49efbdeaa385411c50ea
Reviewed-on: https://review.typo3.org/47491
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Form/Container/FlexFormElementContainer.php
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index 52dbc4c..f085e8f 100644 (file)
@@ -36,7 +36,6 @@ class FlexFormElementContainer extends AbstractContainer
      */
     public function render()
     {
-        $table = $this->data['tableName'];
         $flexFormDataStructureArray = $this->data['flexFormDataStructureArray'];
         $flexFormRowData = $this->data['flexFormRowData'];
         $flexFormFormPrefix = $this->data['flexFormFormPrefix'];
@@ -50,6 +49,8 @@ class FlexFormElementContainer extends AbstractContainer
                 !is_array($flexFormFieldArray)
                 // Not a section or container and not a list of single items
                 || (!isset($flexFormFieldArray['type']) && !is_array($flexFormFieldArray['config']))
+                // Type passthrough is not rendered
+                || (isset($flexFormFieldArray['config']['type']) && $flexFormFieldArray['config']['type'] === 'passthrough')
             ) {
                 continue;
             }
index 4367d5a..6ad39f6 100644 (file)
@@ -3084,6 +3084,20 @@ class DataHandler
                     $this->checkValue_flex_procInData_travDS($dataValues[$key]['el'], $dataValues_current[$key]['el'], $uploadedFiles[$key]['el'], $DSelements[$key]['el'], $pParams, $callBackFunc, $structurePath . $key . '/el/', $workspaceOptions);
                 }
             } else {
+                // init with value from config for passthrough fields
+                if (!empty($dsConf['TCEforms']['config']['type']) && $dsConf['TCEforms']['config']['type'] === 'passthrough') {
+                    if (!empty($dataValues_current[$key]['vDEF'])) {
+                        // If there is existing value, keep it
+                        $dataValues[$key]['vDEF'] = $dataValues_current[$key]['vDEF'];
+                    } elseif (
+                        !empty($dsConf['TCEforms']['config']['default'])
+                        && isset($pParams[1])
+                        && !MathUtility::canBeInterpretedAsInteger($pParams[1])
+                    ) {
+                        // If is new record and a default is specified for field, use it.
+                        $dataValues[$key]['vDEF'] = $dsConf['TCEforms']['config']['default'];
+                    }
+                }
                 if (!is_array($dsConf['TCEforms']['config']) || !is_array($dataValues[$key])) {
                     continue;
                 }