/** * Sets the $TSFE->cObjectDepthCounter in Backend mode * This somewhat hacky work around is currently needed because the cObjGetSingle() function of tslib_cObj relies on this setting * * @param tslib_cObj $addCObj * @return void * @author Bastian Waidelich <*****@*****.**> */ public static function simulateFrontendEnvironment(tslib_cObj $cObj = NULL) { self::$tsfeBackup = isset($GLOBALS['TSFE']) ? $GLOBALS['TSFE'] : NULL; $GLOBALS['TSFE'] = new stdClass(); $GLOBALS['TSFE']->cObjectDepthCounter = 100; $GLOBALS['TSFE']->cObj = $cObj !== NULL ? $cObj : t3lib_div::makeInstance('tslib_cObj'); }