0

我需要在 octoberCMS 后端表单中的中继器内添加选项卡

我对 fields.yaml 的尝试

fields:
    content_items:
        label: "scv.facelessapi::lang.plugin.blocks.fields"
        span: full
        type: repeater
        comment: "scv.facelessapi::lang.plugin.blocks.fields_description"
        prompt: "scv.facelessapi::lang.plugin.custom_actions.add_new_item"
        form:
            fields:
                field_code:
                    label: "Field Code"
                    placeholder: "Field Code"
                    span: storm
                    comment: "Readable field code"
                    required: true
                    cssClass: "col-md-3"
                field_label:
                    label: "Field Label"
                    placeholder: "Field Label"
                span: storm
                comment: "Label of the field"
                required: true
                cssClass: "col-md-3"
                field_type:
                    label: "Field Type"
                    placeholder: "Field Type"
                    span: storm
                    comment: "Input type of the field"
                    required: true
                    cssClass: "col-md-3"
                    type: dropdown
                    options:
                        text: Text
                field_tab:
                    label: "Field Tab"
                    placeholder: "Field Tab"
                    span: storm
                    comment: "Tab of the field"
                    required: true
                    cssClass: "col-md-3"
                    type: dropdown
                    options:
                        content: Content
                        settings: Settings
                field_comment:
                    label: "Field Comment"
                    placeholder: "Field Comment"
                    span: storm
                    comment: "Comment for the field"
                    cssClass: "col-md-12"
            tabs:
                fields:
                    field_comment2:
                        label: "Field Comment"
                        placeholder: "Field Comment"
                        tab: tabexample

到目前为止没有运气,选项卡按钮未显示,字段注释 2 显示在其他字段下(field_code,field_label,...)

也尝试将此链接用作参考,它适用于嵌套形式,但不适用于中继器。[虽然我必须在 [标签] [ https://octobercms.com/docs/backend/forms#widget-nestedform]下添加 [字段] 定义1

感谢任何帮助或示例,谢谢!

4

1 回答 1

1

我找到了将选项卡包装在中继器内的嵌套表单中的解决方案,我想这不是一个好的解决方案,因为它会使保存在数据库中的 json 复杂化:

fields:
    contents:
        type: repeater
        label: Contents
        form:
            fields:
                content:
                     type: nestedform
                     usePanelStyles: false
                     form:
                          tabs:
                              fields:
                                   field_code:
                                        label: Field Code
                                        tab: Basic Settings
                                   field_options:
                                        label: Field Options
                                        type: dropdown
                                        tab: Advanced Settings
于 2019-07-13T22:16:22.503 回答