Actions
Bug #99640
closedf:format.html not working in backend context
Start date:
2023-01-19
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:
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().
Actions