Skip to content

extension

Alberto Parziale edited this page Apr 28, 2020 · 1 revision

Extension

Generating extension of configuration is simple. It is very useful in child themes for example. Let’s create a new config file, naming it “sample_extension.json”. Like everywhere, we have three main fields available:

  • "name" defines the internal name of the configuration we want to extend.
  • "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_extension",
  "spec": {},
  "kind": "extension"
}

If you want to leave this configuration disabled for now, you can add "enabled": false to these fields.

Specs

Now that we've defined the basic informations about the extension, we need to add some informations about what we need.

We need to define the scope of the extension (all other types of configuration are available) and the config spec that we want to add.

{
  "name": "author_info", // the name of the configuration we want to extend
  "spec": {
    "group": { // the scope of the extension (meta, group, section, etc...)
      "fields": [
        {
          "type": "number",
          "id": "age",
          "label": "Author age"
        }
      ]
    }
  },
  "kind": "extension"
}
Clone this wiki locally