From f6c06bc3dc6c61d3b2b5204ebb7a0ea40828008d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20Gro=C3=9Fberndt?= <stephan@grossberndt.de>
Date: Wed, 10 Dec 2014 11:13:43 +0100
Subject: [PATCH] [BUGFIX] Avoid getTCAtypeValue-calls in
 DataHandler->fillInFieldArray

DataHandler->fillInFieldArray fetches BackendUtility::getTCAtypeValue
for each record but uses the value only if several RTE-transformation-
related conditions are met.

Fetch BackendUtility::getTCAtypeValue only if the RTE-transformation-
related conditions are met for the first time and keep it afterwards.

Resolves: #63728
Releases: master, 6.2
Change-Id: I14b307c45cab2d778968f3fd98c18348b666be3d
Reviewed-on: http://review.typo3.org/35227
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
---
 typo3/sysext/core/Classes/DataHandling/DataHandler.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
index 7e7867d61086..0cf1c4578582 100644
--- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php
+++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
@@ -1458,7 +1458,7 @@ class DataHandler {
 		}
 		// Checking for RTE-transformations of fields:
 		$types_fieldConfig = BackendUtility::getTCAtypes($table, $currentRecord);
-		$theTypeString = BackendUtility::getTCAtypeValue($table, $currentRecord);
+		$theTypeString = NULL;
 		if (is_array($types_fieldConfig)) {
 			foreach ($types_fieldConfig as $vconf) {
 				// RTE transformations:
@@ -1467,6 +1467,9 @@ class DataHandler {
 						// Look for transformation flag:
 						switch ((string)$incomingFieldArray[('_TRANSFORM_' . $vconf['field'])]) {
 							case 'RTE':
+								if ($theTypeString === NULL) {
+									$theTypeString = BackendUtility::getTCAtypeValue($table, $currentRecord);
+								}
 								$RTEsetup = $this->BE_USER->getTSConfig('RTE', BackendUtility::getPagesTSconfig($tscPID));
 								$thisConfig = BackendUtility::RTEsetup($RTEsetup['properties'], $table, $vconf['field'], $theTypeString);
 								// Get RTE object, draw form and set flag:
-- 
GitLab