【问题标题】:TYPO3 8.7.17 ext:form - How to reuse Stage/Fieldset?TYPO3 8.7.17 ext:form - 如何重用 Stage/Fieldset?
【发布时间】:2018-07-30 14:39:47
【问题描述】:

大家!

我正在使用扩展程序 form,我想创建自定义表单元素。

我需要从定义的字段列表中创建多行......像这样:

我已关注tutorial written by Manuel Selback 以创建自定义表单元素。我想我可以重用 FieldSet 元素。问题是我的新项目在后端表单编辑器中显示不好(未显示字段名称和类型)。

这是我的代码:

// EXT:my_ext/Configuration/Yaml/BaseSetup.yaml
TYPO3:
  CMS:
    Form:
      prototypes:
        standard:
          formEditor:
            formEditorPartials:
              FormElement-FieldRow: 'Stage/SimpleTemplate'

          formElementsDefinition:
            Form:
              renderingOptions:
                templateRootPaths:
                  100: 'EXT:my_ext/Resources/Private/ext/form/Frontend/Templates/'
                partialRootPaths:
                  100: 'EXT:my_ext/Resources/Private/ext/form/Frontend/Partials/'
                layoutRootPaths:
                  100: 'EXT:my_ext/Resources/Private/ext/form/Frontend/Layouts/'
            FieldRow:
              __inheritances:
                10: 'TYPO3.CMS.Form.prototypes.standard.formElementsDefinition.Fieldset'


// EXT:my_ext/Configuration/Yaml/FormEditorSetup.yaml
TYPO3:
  CMS:
    Form:
      prototypes:
        standard:
          formEditor:
            dynamicRequireJsModules:
              additionalViewModelModules:

            formEditorPartials:
              FormElement-FieldRow: 'Stage/SimpleTemplate'

          formElementsDefinition:
            FieldRow:
              formEditor:
                label: 'formEditor.elements.FieldRow.label'
                group: container
                _isCompositeFormElement: true
                groupSorting: 1000
                iconIdentifier: 't3-form-icon-fieldrow'
                editors:
                  200:
                    label: 'formEditor.elements.FieldRow.editor.label.label'
                  230: null
                  800: null

我错过了什么吗?

非常感谢。

【问题讨论】:

    标签: forms typo3 typo3-8.x typo3-extensions


    【解决方案1】:

    为了更正显示名称和字段类型的问题,我通过添加视图模型 (TYPO3.CMS.Form.prototypes.standard.formEditor.dynamicRequireJsModules.additionalViewModelModules) 编辑了 EXT:my_ext/Configuration/Yaml/FormEditorSetup.yaml :

    // EXT:my_ext/Configuration/Yaml/FormEditorSetup.yaml
    TYPO3:
      CMS:
        Form:
          prototypes:
            standard:
              formEditor:
                dynamicRequireJsModules:
                  additionalViewModelModules:
                    - 'TYPO3/CMS/UnalForm/Backend/FormEditor/FieldRowViewModel'
    

    之后,我创建了 JavaScript 文件 Resources/Public/JavaScript/Backend/FormEditor/FieldRowElementViewModel.js 以在舞台区域中正确显示我的自定义元素。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-06
      • 1970-01-01
      • 2022-01-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多