You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some items that weren't included in the initial proposal which should be processed and included based on the further discussion. Many of the items discussed are very WordPress specific and therefore we need to find a good way to make it explicit what is truly platform agnostic and what is meant to be work only when using it with WordPress.
WordPress automatically discovers all the block.json files in the plugin/core blocks folder and registers the corresponding block types. These block types are made available through the block registry PHP class and the blocks scripts and styles are added as dependencies to the wp-block-library script and style handles.
This is WordPress specific and that's why it wasn't included in the first version. We definitely want to have it implemented but this might be added after some code exploration which will make it easier to solidify.
Client-side properties referenced as files
This was removed from the initial proposal (see this commit: 5ec9cd9) as noted in #13693 (comment):
I removed the following properties from this document:
save
edit
transforms
deprecated
The idea was to keep them referenced from block.json file but this seemed to be a bit confusing in relation to the assets you would normally enqueue in WordPress. This is something we will revisit later as it doesn't seem to be essential for the Block Directory project.
I think we should continue exploring this idea as this could give us some ways to optimize the size of assets loaded by deferring the moment when those files are loaded on the page. In particular deprecated and edit fields loaded only when they are actually used could bring some performance optimizations in case of blocks heavy loaded with JavaScript logic.
We should create a follow-on issue for this. That said, it's not directly mentioned as being possible in this RFC. Which begs the question: Should it be, if we're saying it ought to be possible?
Current the render callback is a function call. How would it work as a file? Why not make it renderTemplate but still allow for renderCallback. Function calls, should be a method in a class or be namespaced, which wouldn't really work in a another file.
ACF blocks, has a rendercallback / render template in it's block definitions.
Continues the work toward server-side awareness of block types: #2751 and follow-up for #13693.
Development Roadmap
This highly related to core blocks and the way they integrate with WordPress.
iconandeditfields (Block library: Standardize file structure of core blocks #14743)name,categoryandattributesinblock.json(Block library: Introduce block.json metadata for all client side blocks #14770, Refactor File block to use block.json metadata #14862, Refactor Tabel block to use block.json metadata #14863)transformsandsavefields to their own files (Refactor File block to use block.json metadata #14862, Refactor Tabel block to use block.json metadata #14863, Refactor core blocks to have save and transforms in their own files (part 1) #14882, Refactor core blocks to have save and transforms in their own files (part 2) #14899, Refactor core blocks to have save and transforms in their own files (part 3) #14902, Refactor core blocks to have save and transforms in their own files (part 4) #14903)mergeordeprecatedto their own files (Refactor core blocks to have deprecated extracted to their own files (p.1) #14979, Block library: Extractdeprecatedfield to their own files #15057, Block library: Extractdeprecatedfield to their own files (p.2) #15071)block.json(reuse code from Introduce block metadata files for dynamic blocks #14238)block.jsonto make them work with both PHP and JavaScript (Block API: Extendregister_block_type_from_metadatato handle assets #22519)registerBlockTypeandregister_block_type_from_metadatato autowrap translatable fields fromblock.jsonwith_x(Block API: Add i18n support toblock.jsonmetadata file #23636, Blocks: Introduce registerBlockTypeFromMetadata API #30293)title,description,keywords,styles.label) toblock.json(Block Library: Move translatable fields toblock.jsonfiles for core blocks #23792)block.jsonand block variations (Block Library: Refactor Embed block to useblock.jsonand block variations #22660)block.jsonfiles and annotate translatable fields (https://core.trac.wordpress.org/ticket/50615, Blocks: Introduce registerBlockTypeFromMetadata API #30293)Proposals
There are some items that weren't included in the initial proposal which should be processed and included based on the further discussion. Many of the items discussed are very WordPress specific and therefore we need to find a good way to make it explicit what is truly platform agnostic and what is meant to be work only when using it with WordPress.
New screenshot property
From @perandre in #13693 (comment)
This seems like a good addition in the context of the block discovery when it isn't installed.
Auto-discover of
block.jsonmetadata fileThe original discussion sparked by a comment from @moorscode in #13693 (comment).
This is WordPress specific and that's why it wasn't included in the first version. We definitely want to have it implemented but this might be added after some code exploration which will make it easier to solidify.
Client-side properties referenced as files
This was removed from the initial proposal (see this commit: 5ec9cd9) as noted in #13693 (comment):
I think we should continue exploring this idea as this could give us some ways to optimize the size of assets loaded by deferring the moment when those files are loaded on the page. In particular
deprecatedandeditfields loaded only when they are actually used could bring some performance optimizations in case of blocks heavy loaded with JavaScript logic.Extend flexibility of
parentpropertyAlso filed in #30679 by @priethor.
See comment from @aduth in #13693 (comment):
Consider adding
renderTemplatepropertySee comment from @spacedmonkey in #13693 (comment):
There is also another thread started by @spacedmonkey in #13693 (comment) which expands on this topic.