From 4fc83a2239b30ac7f86fe35bccea6ca8536c07f5 Mon Sep 17 00:00:00 2001 From: Hannes Bochmann Date: Wed, 10 May 2017 15:16:37 +0200 Subject: [PATCH] bugfix rootline fields --- tests/class.tx_mksearch_tests_Util.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/class.tx_mksearch_tests_Util.php b/tests/class.tx_mksearch_tests_Util.php index 27a3e0dc..4f6746a6 100644 --- a/tests/class.tx_mksearch_tests_Util.php +++ b/tests/class.tx_mksearch_tests_Util.php @@ -66,7 +66,7 @@ class tx_mksearch_tests_Util /** * @var string */ - private static $addRootLineFieldsBackup; + private static $addRootLineFieldsBackup = null; /** * Sichert die hoocks unt entfernt diese in der globalconf. @@ -433,6 +433,12 @@ public static function emptyAddRootlineFields() { self::$addRootLineFieldsBackup = $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']; $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] = ''; + if (tx_rnbase_util_TYPO3::isTYPO62OrHigher()) { + $property = new ReflectionProperty('TYPO3\\CMS\\Core\\Utility\\RootlineUtility', 'rootlineFields'); + $property->setAccessible(true); + $rootLineFields = Tx_Rnbase_Utility_Strings::trimExplode(',', self::$addRootLineFieldsBackup, true); + $property->setValue(null, array_diff($property->getValue(null), $rootLineFields)); + } } /** @@ -440,7 +446,16 @@ public static function emptyAddRootlineFields() */ public static function resetAddRootlineFields() { - $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] = self::$addRootLineFieldsBackup; + if (self::$addRootLineFieldsBackup != null) { + $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] = self::$addRootLineFieldsBackup; + if (tx_rnbase_util_TYPO3::isTYPO62OrHigher()) { + $property = new ReflectionProperty('TYPO3\\CMS\\Core\\Utility\\RootlineUtility', 'rootlineFields'); + $property->setAccessible(true); + $rootLineFields = Tx_Rnbase_Utility_Strings::trimExplode(',', self::$addRootLineFieldsBackup, true); + $property->setValue(null, array_unique(array_merge($property->getValue(null), $rootLineFields))); + } + self::$addRootLineFieldsBackup = null; + } } }