-
Notifications
You must be signed in to change notification settings - Fork 5
group
Alberto Parziale edited this page Apr 28, 2020
·
1 revision
Generating group of fields is simple. Let’s create a new config file, naming it “sample_group.json”. Like everywhere, we have three main fields available:
-
"name"
defines the internal name for this config file. -
"kind"
defines the type of configuration: we’re gonna set it to"group"
to create a group of fields. -
"spec"
defines our settings page specific configuration.
{
"name": "sample_group",
"spec": {},
"kind": "group"
}
If you want to leave this configuration disabled for now, you can add "enabled": false
to these fields.
Now that we've defined the basic informations about the group, we need to add some informations about what we need.
We can define a group of fields that we can reuse all around our configurations, using the same structure of meta's fields:
{
"name": "author_info",
"spec": {
"fields": [
{
"type": "text",
"id": "author-name",
"label": "Author name"
},
{
"type": "text",
"id": "author-surname",
"label": "Author surname"
}
]
},
"kind": "group"
}
and then we can include it in other configuration like follows:
[...], // other specs
"fields": [
[...], // other fields
{
"type": "group",
"id": "author_info"
},
[...] // other fields
],
[...] // other specs