I created a hook (with a function afterBuildingFinished
) that take a string and parse it into typoscript.
Now I want to take that typoscript to override a form (yaml) default value with. I don't understand how to ''process'' the typoscript. Like, i'm missing the step after get the typoscript parsed.
This is a part of my code :
public function afterBuildingFinished(RenderableInterface $renderable): void {
#some code here ...
#My parsing code :
$parseObj = GeneralUtility::makeInstance(TypoScriptParser::class);
$parseObj->parse($stringToParse);
$TSparse = $parseObj->setup; #this is use to access the parse typoscript
#Now, what do I do after?
}
My purpose is to prefill renderable of a form with user info via a typoscript string.
Thanks.
I figured it out and needed to change a little bit my code.
Here is the new one :
public function afterBuildingFinished(RenderableInterface $renderable): void {
#some code here ...
#My parsing code :
$parseObj = GeneralUtility::makeInstance(TypoScriptParser::class);
$parseObj->parse($stringToParse);
#This process the typoscript
#$value stock user info for a X renderable
$cObject = GeneralUtility::makeInstance(ObjectManager::class)->get(ContentObjectRenderer::class);
$value = $cObject->cObjGet($parseObj->setup);
#Some code to set the default value of the renderable
}
To answer my question: after parsing the code, I need to process the typoscript with cObject and then set the default value of the renderable with classic setDefaultValue() functions.