【问题标题】:How to override a form default value with parsed typoscript如何使用已解析的打字稿覆盖表单默认值
【发布时间】:2020-02-13 15:43:41
【问题描述】:

我创建了一个钩子(带有一个函数afterBuildingFinished),它接受一个字符串并将其解析为打字稿。 现在我想用那个打字稿来覆盖表单(yaml)的默认值。我不明白如何“处理”打字稿。就像,我在解析打字稿后错过了这一步。

这是我的代码的一部分:

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?
}

我的目的是通过打字稿字符串用用户信息预填充可呈现的表单。

谢谢。

【问题讨论】:

    标签: php forms typo3 hook typoscript


    【解决方案1】:

    我想通了,需要稍微修改一下我的代码。

    这是新的:

    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
    }
    

    回答我的问题:解析代码后,我需要使用cObject 处理打字稿,然后使用经典的 setDefaultValue() 函数设置可渲染的默认值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-14
      • 2011-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多