Projekt

Allgemein

Profil

GX-Feature #70548

Von Alexandre Ataides vor mehr als 1 Jahr aktualisiert

A repeater option would be handy when creating new widgets like Tabs, Carousel Images, Accordions, and so on. 

 The repeater option should allow us to create a group of options (Textbox, Image, Numberbox, Checkbox, etc.) just so we iterate through these options and "easily" show them in SE4. 
 In the example below, there is an array of `fields`, which contains the `textbox` and `longtextbox` options. 

 ``` 
 // Example of a widget.json file using the repeater 
 ... 
 "description" : "tabsWidget.description", 
 "cache" : 0, 
 "version" : "1.0.0", 
 "displayConfig" : "modal", 
 "fieldsets" : [ 
 { 
     "title" : "tabsWidget.options.content.title", 
     "options" : [ 
         { 
             "id" : "repeater", 
             "type" : "repeater", 
             "label" : "Tabs", 
             "attributes" : { 
                 "min" : 1, 
                 "max" : 4, 
                 "itemLabel": "Tab". 
                 "addMoreLabel" : "Add Tab", 
                 "canSetDefaultActiveIndex" : true, 
                 "defaultActiveIndex": 0 
             }, 
             "fields" : [ 
                 { 
                     "id": "id" : "title", 
                     "type": "type" : "textbox", 
                     "label": "label" : "Title", 
                     "translatable": true, 
                     "default": { 
                         "en": "", 
                         "de": "value" : "" 
                     } 
                 }, 
                 { 
                     "id" : "content", 
                     "translatable": true, "default" : { 
                         "en" : { 
                             "value" : "", 
                             "title" : "" 
                         }, 
                         "de" : { 
                             "value" : "", 
                             "title" : "" 
                         } 
                     }, 
                     "type" : "longtextbox", 
                     "value" : "", 
                     "label" : "tabsWidget.options.text.label", 
                     "attributes" : { 
                         "placeholder" : "tabsWidget.options.text.placeholder" 
                     }, 
                     "default" : { 
                         "en" : "", 
                         "de" : "" 
                     }, } 
                 } 
             ], 
             "default" : [ 
                 [ 
                     { 
                         "id": "my-title-id", "id" : "my-title", 
                         "type": "type" : "textbox", 
                         "label": "repeaterField" : "title", 
                         "label" : "Title", 
                         "translatable": true, "value" : "Foo" 
                     }, 
                     { 
                         "repeaterField": "title", "id" : "my-content", 
                         "default": "repeaterField" : "content", 
                         "default" : { 
                             "en": "en" : { 
                                 "value" : "", 
                                 "title" : "" 
                             "de": }, 
                             "de" : { 
                                 "value" : "", 
                                 "title" : "" 
                             } 
                         } 
                     }, 
                     { 
                         "id": "my-title-content", 
                         "type": "type" : "longtextbox", 
                         "label": "value" : "Foo text", 
                         "label" : "tabsWidget.options.text.label", 
                         "translatable": true, 
                         "repeaterField": "content", 
                         "attributes": "attributes" : { 
                             "placeholder": "placeholder" : "tabsWidget.options.text.placeholder" 
                         }, 
                         "default": { 
                             "en": "", 
                             "de": "" 
                         } 
                     } 
                 ] 
             ] 
         } 
     ] 
 }, 
 ... 
 ``` 

 As to test a Widget is needed it's better if only a code review is done, then we test the `RepeaterOption` in one of the new widgets: `Tabs, Carousel, Accordion, etc`.

Zurück