Closed chrillep closed 7 months ago
Ping! 😀 @mattgrshaw @lgladdy
Upvote 🙌
Hey folks,
I spoke about this a little in ACF Chat Fridays this week - we will publishing a schema for ACF Blocks block.json
shortly, we're just figuring out the best place to store it and how to publish it in a way that makes sense for folks to consume. Stay tuned!
Any updates on the schema?
Here is how I currently use one:
block.json
:
{
"$schema": "../schema.json",
"name": "acf/centralised-content",
"title": "Centralised Content",
"description": "A centralised content block.",
"category": "page-builder",
"icon": "align-center",
"keywords": [
"centralised", "content", "center", "centre", "centered"
],
"acf": {
"mode": "preview",
"renderTemplate": "centralised-content.php"
}
}
schema.json
:
{
"allOf": [
{
"$ref": "https://schemas.wp.org/trunk/block.json"
}
],
"properties": {
"acf": {
"type": "object",
"description": "An Object containing ACF specific block configuration",
"properties": {
"mode": {
"type": "string",
"description": "The display mode for your block",
"default": "auto",
"enum": [
"auto",
"edit",
"preview"
]
},
"renderTemplate": {
"type": "string",
"description": "The path to a template file used to render the block HTML. This can either be a relative path to a file based on where your block.json file is located, or an absolute path"
},
"renderCallback": {
"type": "string",
"description": "Instead of providing a render_template, a callback function name may be specified to output the block’s HTML."
},
"postTypes": {
"type": "array",
"description": "An array of post types to restrict this block type to"
},
"blockVersion": {
"type": "number",
"description": "The ACF block version this block should use. Defaults to 2",
"default": 2
}
}
}
}
}
Inspired by https://gist.github.com/saulirajala/359775273c62fa19ea232ced18c10712
https://www.schemastore.org/json/ makes sense
Hey folks, we've published a schema here - https://github.com/AdvancedCustomFields/schemas
could acf maintain this schema instead ? https://gist.github.com/saulirajala/359775273c62fa19ea232ced18c10712
Copy from WP block.json schema (https://schemas.wp.org/trunk/block.json), but added support for acf key as defined here: https://www.advancedcustomfields.com/resources/acf-blocks-with-block-json/
We want better acf key support right? 😉
https://www.advancedcustomfields.com/feedback/p/maintain-extended-blockjson-schema