Issue Bug Closed

#66855Format/HtmlViewHelper don't render Links in TYPO3_MODE = BE

Carsten Biebricher 05/08/15, 14:50 updated 03/07/20, 11:35

Description

When I use the HtmlViewHelper in the BackendEnviroment (in my case to send emails with the scheduler) links aren’t be rendered with the HtmlViewHelper. In fact they were removed from the HTML.

After some debugging it points out, that the function simulateFrontendEnvironment in the HtmlViewHelper were different to the function of the \TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility::simulateFrontendEnvironment especially in the point with the $GLOBALS['TSFE']->cObjectDepthCounter.

When set the cObjectDepthCounter in the HtmlViewHelper all links will be rendered in the right way.

Not setting the cObjectDepthCounter will result in the early exit in /typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php on line 718.

714    public function cObjGetSingle($name, $conf, $TSkey = '__') {
715        global $TYPO3_CONF_VARS;
716        $content = '';
717        // Checking that the function is not called eternally. This is done by interrupting at a depth of 100
718        $GLOBALS['TSFE']->cObjectDepthCounter--;
719        if ($GLOBALS['TSFE']->cObjectDepthCounter > 0) {

I have created two different patches.
Patch one use the \TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility::simulateFrontendEnvironment
Patch two set the cObjectDepthCounter by its own

This problem may occure in other BackendEnviroment situations with simulated Frontend Enviroments.

Reviews 2