[TASK] Allow type 'text' in site configuration 18/58818/4
authorGeorg Ringer <georg.ringer@gmail.com>
Thu, 1 Nov 2018 19:31:38 +0000 (20:31 +0100)
committerBenni Mack <benni@typo3.org>
Fri, 2 Nov 2018 09:12:45 +0000 (10:12 +0100)
As yaml supports multiline text, it should be also allowed inside the
site configuration.
With #86214 the type 'text' has been allowed within inline relations.

Resolves: #86825
Releases: master
Change-Id: I2f0172e061cd277e23cf44390930864c7481c98b
Reviewed-on: https://review.typo3.org/58818
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Classes/Controller/SiteConfigurationController.php

index a262dbd..7bd447d 100644 (file)
@@ -251,52 +251,60 @@ class SiteConfigurationController
             $newSysSiteData['rootPageId'] = $pageId;
             foreach ($sysSiteRow as $fieldName => $fieldValue) {
                 $type = $siteTca['site']['columns'][$fieldName]['config']['type'];
-                if ($type === 'input') {
-                    $fieldValue = $this->validateAndProcessValue('site', $fieldName, $fieldValue);
-                    $newSysSiteData[$fieldName] = $fieldValue;
-                } elseif ($type === 'inline') {
-                    $newSysSiteData[$fieldName] = [];
-                    $childRowIds = GeneralUtility::trimExplode(',', $fieldValue, true);
-                    if (!isset($siteTca['site']['columns'][$fieldName]['config']['foreign_table'])) {
-                        throw new \RuntimeException('No foreign_table found for inline type', 1521555037);
-                    }
-                    $foreignTable = $siteTca['site']['columns'][$fieldName]['config']['foreign_table'];
-                    foreach ($childRowIds as $childRowId) {
-                        $childRowData = [];
-                        if (!isset($data[$foreignTable][$childRowId])) {
-                            if (!empty($currentSiteConfiguration[$fieldName][$childRowId])) {
-                                // A collapsed inline record: Fetch data from existing config
-                                $newSysSiteData[$fieldName][] = $currentSiteConfiguration[$fieldName][$childRowId];
-                                continue;
-                            }
-                            throw new \RuntimeException('No data found for table ' . $foreignTable . ' with id ' . $childRowId, 1521555177);
+                switch ($type) {
+                    case 'input':
+                    case 'text':
+                        $fieldValue = $this->validateAndProcessValue('site', $fieldName, $fieldValue);
+                        $newSysSiteData[$fieldName] = $fieldValue;
+                        break;
+
+                    case 'inline':
+                        $newSysSiteData[$fieldName] = [];
+                        $childRowIds = GeneralUtility::trimExplode(',', $fieldValue, true);
+                        if (!isset($siteTca['site']['columns'][$fieldName]['config']['foreign_table'])) {
+                            throw new \RuntimeException('No foreign_table found for inline type', 1521555037);
                         }
-                        $childRow = $data[$foreignTable][$childRowId];
-                        foreach ($childRow as $childFieldName => $childFieldValue) {
-                            if ($childFieldName === 'pid') {
-                                // pid is added by inline by default, but not relevant for yml storage
-                                continue;
+                        $foreignTable = $siteTca['site']['columns'][$fieldName]['config']['foreign_table'];
+                        foreach ($childRowIds as $childRowId) {
+                            $childRowData = [];
+                            if (!isset($data[$foreignTable][$childRowId])) {
+                                if (!empty($currentSiteConfiguration[$fieldName][$childRowId])) {
+                                    // A collapsed inline record: Fetch data from existing config
+                                    $newSysSiteData[$fieldName][] = $currentSiteConfiguration[$fieldName][$childRowId];
+                                    continue;
+                                }
+                                throw new \RuntimeException('No data found for table ' . $foreignTable . ' with id ' . $childRowId, 1521555177);
                             }
-                            $type = $siteTca[$foreignTable]['columns'][$childFieldName]['config']['type'];
-                            switch ($type) {
-                                case 'input':
-                                case 'select':
-                                case 'text':
-                                    $childRowData[$childFieldName] = $childFieldValue;
-                                    break;
-                                case 'check':
-                                    $childRowData[$childFieldName] = (bool)$childFieldValue;
-                                    break;
-                                default:
-                                    throw new \RuntimeException('TCA type ' . $type . ' not implemented in site handling', 1521555340);
+                            $childRow = $data[$foreignTable][$childRowId];
+                            foreach ($childRow as $childFieldName => $childFieldValue) {
+                                if ($childFieldName === 'pid') {
+                                    // pid is added by inline by default, but not relevant for yml storage
+                                    continue;
+                                }
+                                $type = $siteTca[$foreignTable]['columns'][$childFieldName]['config']['type'];
+                                switch ($type) {
+                                    case 'input':
+                                    case 'select':
+                                    case 'text':
+                                        $childRowData[$childFieldName] = $childFieldValue;
+                                        break;
+                                    case 'check':
+                                        $childRowData[$childFieldName] = (bool)$childFieldValue;
+                                        break;
+                                    default:
+                                        throw new \RuntimeException('TCA type ' . $type . ' not implemented in site handling', 1521555340);
+                                }
                             }
+                            $newSysSiteData[$fieldName][] = $childRowData;
                         }
-                        $newSysSiteData[$fieldName][] = $childRowData;
-                    }
-                } elseif ($type === 'select') {
-                    $newSysSiteData[$fieldName] = (int)$fieldValue;
-                } else {
-                    throw new \RuntimeException('TCA type ' . $type . ' not implemented in site handling', 1521032781);
+                        break;
+
+                    case 'select':
+                        $newSysSiteData[$fieldName] = (int)$fieldValue;
+                        break;
+
+                    default:
+                        throw new \RuntimeException('TCA type "' . $type . '" is not implemented in site handling', 1521032781);
                 }
             }