-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Block Transforms Don't Honor isDefault
Block Variations
#28119
Comments
I would say this is undocumented behavior, but then the whole of block variations seems to be undocumented 😬 This would probably be challenging to get working as expected, since each block transform calls |
I agree that block variations documentation is in desperate need of improvement! If the That said, it also seems like block transforms will ideally be a lot more flexible in the long term, and so maybe this is useful input on one of the many ways it should make it easier to transform blocks in the most user-friendly way. |
Block variations are documented in several places:
It would be beneficial to add a tutorial that covers it more in-depth.
It all depends on the
There is now also new scope |
Hi, Just want to know if this bug 'isDefault: true' for Block Variations fixed yet. I was trying this tutorial (https://fullsiteediting.com/lessons/block-variations/) and want my new block variation to be default, but it's not making it the default one. Thanks! |
Just wanted to add that block variations added through the PHP add_filter('block_type_metadata', function($meta) {
if($meta['name'] == "core/buttons") {
$meta['variations'] = [
[
"title" => "A different button",
"name" => "buttonzzz",
"icon" => "with-arrow-left",
"innerBlocks" => [
["core/button", ["text"=>"This button is the new default"]]
],
"attributes" => [],
"isDefault" => true
]
];
}
return $meta;
}); |
Describe the bug
Transforming to a block ignores a custom default style variation and uses core options instead (e.g. no image fill setting).
To reproduce
Here's an example of a simple Block Variation with
isDefault = true
. It makes the Media & Text block use the "Crop Image to Fill Entire Column" option be default.isDefault
set totrue
. (Example below sets Media & Text block to use "Crop image to fill entire column" option by default)Result: The core default block is used.
Expected behavior
The block variation with
isDefault
should be used when a block is transformed to its type.Screenshots
Here's my real-world example for the following variation (sets an option and background color, changes inner block to not have Large font size):
Editor version (please complete the following information):
Desktop (please complete the following information):
Possibly related to…
#23722 #26962
The text was updated successfully, but these errors were encountered: