-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Labels
[Feature] BlocksOverall functionality of blocksOverall functionality of blocks[Package] Block editor/packages/block-editor/packages/block-editor[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
Issue:
When adding a custom core block variation, the details ( title, icon, description ) are not updated in the "Settings Sidebar" section. Hence there is no way to distinguish between custom core block variations and core blocks once a block is added.
Note: I did report this earlier in core-trac without knowing that it had to be reported here. Below is the core trac reference.
https://core.trac.wordpress.org/ticket/58432
Step-by-step reproduction instructions
- Add support for block variations to your existing theme.
function prefix_editor_assets() {
wp_enqueue_script(
'prefix-block-variations',
get_template_directory_uri() . '/assets/js/blocks/block-variations.js',
array( 'wp-blocks' )
);
}
add_action( 'enqueue_block_editor_assets', 'prefix_editor_assets' );
- Create a custom core block variation
wp.blocks.registerBlockVariation(
'core/group',
{
name: 'card-group',
title: 'Card group',
description: 'A group with card styling',
label: 'Card group',
icon: 'wordpress',
attributes: {
className: 'card-group',
},
innerBlocks: [
[ 'core/heading', { content: '' } ],
[ 'core/paragraph', { content: '' } ],
]
}
);
- Check inside editor for new core block variation.
- Add new core block variation and check the siderbar with the block selected.
Note: I used the following tutorial by Carolina Nymark to create the variation
https://fullsiteediting.com/lessons/block-variations/
Custom.Core.Block.Variation.mov
Screenshots, screen recording, code snippet
No response
Environment info
WordPress - 6.2.2
Theme - Twenty Twenty-Two
Tried with and without Guttenberg
Gutenberg: 15.9.1
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Feature] BlocksOverall functionality of blocksOverall functionality of blocks[Package] Block editor/packages/block-editor/packages/block-editor[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Type
Fields
Give feedbackNo fields configured for issues without a type.