Expand my Community achievements bar.

Creating multi filed block model definitions in EDS Universal editor

Avatar

Level 2

Hi All,

 

Can someone please guide on how to create multifiled button in block model.

 

I want to create tease block with multifield button. Need two property for button link and button title same way how we can do in AEM component. 

I didn’t find any documentation to achieve this. 

 

Regards

Sofiyan

 

 

1 Reply

Avatar

Community Advisor

Hi @sofiyans8042875 

You can create a block (Buttons) and blockItem (Button)

{
    "definitions": [
        {
            "title": "Buttons",
            "id": "buttons",
            "plugins": {
                "xwalk": {
                    "page": {
                        "resourceType": "core/franklin/components/block/v1/block",
                        "template": {
                            "name": "Buttons",
                            "filter": "buttons"
                        }
                    }
                }
            }
        },
        {
            "title": "Button",
            "id": "button",
            "plugins": {
                "xwalk": {
                    "page": {
                        "resourceType": "core/franklin/components/block/v1/block/item",
                        "template": {
                            "name": "Button",
                            "model": "button"
                        }
                    }
                }
            }
        }
    ],
    "models": [
        {
            "id": "button",
            "fields": [
                {
                    "component": "richtext",
                    "name": "text",
                    "value": "",
                    "label": "Text",
                    "valueType": "string"
                }
            ]
        }
    ],
    "filters": [
        {
            "id": "buttons",
            "components": [
                "button"
            ]
        }
    ]
}

Then post this you can write the logic in your class i.e. buttons.js to fetch all the child elements of the blockItem i.e. button and render it as per the desired HTML.

Hope this helps!

Thanks