Tab inside repeater

217 Views Asked by At

I need to add tabs inside repeater in octoberCMS backend form

what i tried with 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

no luck so far, the tabs buttons are not shown, and field comment 2 is shown under the other fields (field_code, field_label, ...)

tried to use this link as reference too, it works with nested form, but not with repeater. [although i had to add [fields] definition under [tabs] [https://octobercms.com/docs/backend/forms#widget-nestedform]1

Any help or example is appreciated, thanks!

1

There are 1 best solutions below

0
On

I found the solution to wrap the tabs inside a nested form inside the repeater, it's not a good solution i suppose, since it will complicate the json saved in database:

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