Issue Task Closed

#65423Make condition-matching in TemplateService independent of global TSFE

Stefan Neufeind 02/28/15, 22:01 updated 03/19/20, 20:32

Description

To load the TypoScript for an arbitrary page in FE you can do something like:
$tmpl = GeneralUtility::makeInstance(‘TYPO3\\CMS\\Core\\TypoScript\\TemplateService’);
$tmpl->start($rootLine);

Then $tmpl->setup will contain the TypoScript-setup for that page. But condition-matching (PIDinRootLine, …) still works against the original page (using $GLOBALS[‘TSFE’]) and not the page/rootline of our new TemplateService-instance.

Temporary workaround:
Overwrite parts of the global TSFE (of course backup them first) before calling $tmpl->start().
$GLOBALS[‘TSFE’]->id = $returnPid;
$GLOBALS[‘TSFE’]->tmpl->rootLine = $rootLine;

Reviews 0

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