-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for block variations #80
Comments
I've changed the Block CPT so that it's hierarchical. This request appears to be coming from Note: 1748 is the correct ID of the parent but it's not a https://s.b/wordpress/wp-json/wp/v2/block/1748 The same thing happens for the File CPT.... which has been hierarchical for a long time now. |
New logic needs to be developed to create/update a block variation. This requires a co-requisite change in the |
Examples of titles and permalinks for the WordPress variation of the Social link block
|
The changes seem to have uncovered a couple of issues with the SQL being run.
|
Released in v1.41.2 |
Since Feb 2020 it's been possible to register variations of blocks.
In Gutenberg 8.9.3 there are now 47 core blocks and 84 variations. 131 in total.
The following core blocks have variations:
A block variation is registered with the same name as the block ( e.g.
core/social-link
) to which it's a variation and has a unique name that identifies it amongst variations of that block.Some of the fields for a variation are optional.
If undefined then the values are inherited from the parent at runtime.
For an example see the variation of
core/search
which has a name ofdefault
.The variation
name
is not unique between blocks; bothcore/embed
andcore/social-link
have variations calledwordpress
.As I see it there two options for recording the information in posts:
block_variation
, similar toblock_example
, with a noderef to the parent block CPT.e.g. for the
wordpress
variation ofcore/social-link
create the post as one of the following:For the social-link blocks, the permalink using the
block_variation
method matches the original naming, but with a different CPT. I currently think that the hierarchical version makes the relationship clearer.Implementation considerations
I've decided to attempt to implement the hierarchical solution.
block
CPT, the unique name for the block variation would need to be stored as_block_variation
Note: To make the
block
CPT work as a hierarchical post type in blocks.wp.a2z I needed to delete then re-add the override to the block CPT in oik-types. The override was to set the number per page to 54.Before doing this Gutenberg was displaying a Post Attributes panel not Page Attributes.
The text was updated successfully, but these errors were encountered: