Task #65423
closedMake condition-matching in TemplateService independent of global TSFE
0%
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;
Updated by Susanne Moog over 5 years ago
- Status changed from New to Needs Feedback
It's not as easy / only about the condition matcher - the cache entry generated in template service will also reference the original tsfe ID. At the moment, overwriting that ID and rootline seems to be the only way to ensure consistency.
ConditionMatching itself is done independent from the TemplateService - but could get arguments to allow setting rootline and id from outside.
So this issue is basically two issues, what do you think - and can you tackle them?
Updated by Benni Mack over 4 years ago
- Status changed from Needs Feedback to Closed
Closing this issue now due to lack of feedback. @Stefan feel free to re-open the ticket if you want to