Issue Bug Closed

#99640f:format.html not working in backend context

Oliver Weiss 01/19/23, 11:38 updated 03/13/23, 21:27

Description

When using f:format.html in backend context (e.g. template in a scheduler), the parseFunc doesn’t return anything.

The method simulateFrontendEnvironment creates $GLOBALS[‘TSFE’] and $GLOBALS[‘TSFE’]->tmpl with new standard classes:
typo3/sysext/fluid/Classes/ViewHelpers/Format/HtmlViewHelper.php, Line 134:

    protected static function simulateFrontendEnvironment()
    {
        self::$tsfeBackup = $GLOBALS['TSFE'] ?? null;
        $GLOBALS['TSFE'] = new \stdClass();
        $GLOBALS['TSFE']->tmpl = new \stdClass();
        $configurationManager = GeneralUtility::makeInstance(ConfigurationManagerInterface::class);
        $GLOBALS['TSFE']->tmpl->setup = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
    }

In the ContentObjectRenderer, the method mergeTSRef has changed. Since V 11, it checks the class types of $GLOBALS[‘TSFE’] and $GLOBALS[‘TSFE’]->tmpl and this check fails now
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php, Line 5552:

           if ($tsfe instanceof TypoScriptFrontendController
                && $tsfe->tmpl instanceof TemplateService
                && is_array($tsfe->tmpl->setup)
            ) {
                $setupArray = $tsfe->tmpl->setup;
            }

Possible solution is to make new instances of the correct classes in simulateFrontendEnvironment().

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.