[wp-trac] [WordPress Trac] #60856: Group block variations added via get_block_type_variations aren't loaded

WordPress Trac noreply at wordpress.org
Fri Mar 29 13:32:28 UTC 2024


#60856: Group block variations added via get_block_type_variations aren't loaded
--------------------------+-----------------------------
 Reporter:  bacoords      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  General       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+-----------------------------
Changes (by joemcgill):

 * milestone:  Awaiting Review => Future Release


Comment:

 Hi @bacoords, thanks for the report. It looks to me like the core/group
 block does not register any of its variations on the server and instead
 these
 [https://github.com/WordPress/gutenberg/blob/e03b68cc5c35c0666281ad7f7dc6474495833e6e/packages
 /block-library/src/group/index.js#L88 are getting added to the block in
 JS] in the editor. The server supplied block data can be observed by
 inspecting the output of the `get_block_editor_server_block_settings()`
 function.

 The `get_block_type_variations` filter will allow you to modify the list
 of variations that are registered on the server, but if a block is adding
 variations at runtime, then any variations supplied from the server will
 overwritten. This is probably an oversight that will need to be corrected
 with the way the block editor handles merging server supplied variations
 with client supplied variations. This will need to be fixed upstream, so
 I'll open a related ticket [https://github.com/WordPress/gutenberg on the
 Gutenberg repo].

 In the mean time, I would suggest registering your variations in JS using
 [https://developer.wordpress.org/block-editor/reference-guides/block-api
 /block-variations/#creating-a-block-variation these instructions].

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60856#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list