Bug #99640
closedf:format.html not working in backend context
0%
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().
Updated by Chris Müller almost 2 years ago
- Status changed from New to Needs Feedback
The HtmlViewHelper should not be used in backend context:
https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/fluid/Classes/ViewHelpers/Format/HtmlViewHelper.php#L26-L33
Updated by Sybille Peters over 1 year ago
- Status changed from Needs Feedback to Closed
As pointed out: is not a bug and is documented that vh should not be used in BE.
No feedback for 2 months.
Closing for now.