Get FlexForm configuration in TypoScript

别来无恙 提交于 2019-12-11 06:07:30

问题


I need to get the page.headerData in typoscript from pi_flexform.How can implement my requirement?

page = PAGE
page {
  headerData {
    10 = TEXT
    10.value =<script>/**********************/</script>
  }
}

回答1:


I am not so sure about what you really need. I am guessing you want to access a FlexForm configuration inside your TypoScript?

Since the version 8.4 this is possible by using plain TypoScript

lib.flexformContent = CONTENT
lib.flexformContent {
    table = tt_content
    select {
        pidInList = this
    }

    renderObj = COA
    renderObj {
        10 = TEXT
        10 {
            data = flexform: pi_flexform:settings.categories
        }
    }
}

The key flexform is followed by the field which holds the flexform data and the name of the property whose content should be retrieved.

Before 8.4 you need to use a userFunc and retrieve the value by using PHP

 $flexFormService = GeneralUtility::makeInstance(FlexFormService::class);
 $flexFormKey = str_replace('.', '|', $keyParts[1]);
 $settings = $flexFormService->convertFlexFormContentToArray($flexFormContent); 


来源:https://stackoverflow.com/questions/40625082/get-flexform-configuration-in-typoscript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!