Skip to content

Commit

Permalink
bugfix rootline fields
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesbochmann committed May 10, 2017
1 parent cd70c90 commit 4fc83a2
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/class.tx_mksearch_tests_Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -433,14 +433,29 @@ 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));
}
}

/**
* @return void
*/
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;
}
}
}

Expand Down

0 comments on commit 4fc83a2

Please sign in to comment.