Register block in dashboard
Once you have created a custom block, For merchants to use the block in Appmaker Dashboard, you need to register the block in the appmaker-custom-blocks.json
file.
Create a new file in the root of the theme
Create a new file appmaker-custom-blocks.json
in the root of the theme. and list all the blocks schema that you want to register in the Appmaker Dashboard.
appmaker-custom-blocks.json
[
{
"title": "My custom block name",
"name": "my-theme/my-custom-block",
"attributesSchema": {
"properties": [{
"id" : "title",
"type": "string",
"label": "title"
}]
},
"config": {
"innerBlockConfig": {
"allowedBlocks": ["my-theme/my-custom-block-item"]
}
}
}
]
Optional : Add custom inner block item in Appmaker Dashboard
appmaker-custom-blocks.json
[
{
"title": "My custom inner block name",
"name": "my-theme/my-custom-block-item",
"attributesSchema": {
"properties": [{
"id" : "title",
"type": "string",
"label": "title"
}]
},
"config": {
"parent": ["my-theme/my-custom-block"]
}
}
]
Block schema properties
Property | Type | Description | Example |
---|---|---|---|
title | string | Title of the block | My custom block name |
name | string | Name of the block | my-theme/my-custom-block |
attributesSchema | object | Schema of the attributes of the block | Attributes Shema |
config | object | Config of the block |
Config properties
Property | Type | Description | Example |
---|---|---|---|
innerBlockConfig | object | Config of the inner block | Inner block config |
parent | array | Parent of the block | ["my-theme/my-custom-block"] |
Inner block config properties
Property | Type | Description | Example |
---|---|---|---|
allowedBlocks | array | Allowed blocks | ["my-theme/my-custom-block-item"] |