How to parse TypoScript using the new parser in TYPO3 12+

54 Views Asked by At

There seem to be no information on how to use the new TypoScript parser. Announcement was made here without a single explanation or example on how to use the new parser in place of the old. I have this code that I've been using single early versions and works all the way up to version 12 (with deprecation notices. Code is in the ContentObjectPostInitHook.

$typoScriptParser=new TypoScriptParser();
$typoScriptParser->parse($configuration['TypoScript']);
$GLOBALS['TSFE']->tmpl->setup['lib.']['menux']=$typoScriptParser->setup;

$setup=typoScriptParser->getVal($configuration['TypoScriptObjPath'], $GLOBALS['TSFE']->tmpl->setup);

The TypoScriptParser class has now been marked for deprecation in version 13. TypoScriptFrontendController class' tmpl property has also been deprecated. We are advised to use the new parser. How do I refactor this code to the new standard? Thank you.

0

There are 0 best solutions below