How to ceate default Field Type 'set'

#1

Hey Lovely people!
I want to build default Field Type that make set with this Options:

 {
   "fields": [
     {
       "type": "slug",
       "name": "slug",
       "label": "Slug"
     },
     {
       "type": "collectionlink",
       "name": "components",
       "label": "Components",
       "options": {
         "link": "components",
         "multiple": false
       }
     }
   ]
 }
#2

Please add some more details. I don’t understand, what you’re trying to achieve. What’s the actual problem and what do you mean with “default”?

#3

Thanks for your reply,
So I have in every singleton Field
name: template
type: set
option:

 {
   "fields": [
     {
       "type": "slug",
       "name": "slug",
       "label": "Slug"
     },
     {
       "type": "collectionlink",
       "name": "components",
       "label": "Components",
       "options": {
         "link": "components",
         "multiple": false
       }
     }
   ]
 }

And I don’t want every time to copy that, I want to build field type like that,
I try to use with Layout Components, but it’s make the data very deep, I need it in the root or maximum as a son

#4

I never used the Layout Components Addon or the layout builder fields. I can’t help here. But if you want to create custom fields, you can look at the core fields, modfiy them and place them in /path/to/cockpit/config/tags.

#5

This is what I tried to do but I don’t know how actually to use with “set” and put my default options as new custom fields :frowning:

#6

I wrote a demo file. Adjust it to your needs.

1 Like
#7

Thank you very much! you are the BEST!