WordPress.org

Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#52512 closed defect (bug) (fixed)

Blocks: Add missing apiVersion field when preparing server-registered blocks for the block editor

Reported by: gziolo Owned by: gziolo
Milestone: 5.7 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch
Focuses: Cc:

Description (last modified by gziolo)

When working on changes to @wordpress/create-block tool (https://github.com/WordPress/gutenberg/pull/28883) to use register_block_type_from_metadata with block.json file in the templates for scaffolded blocks I run into this issue where apiVersion wasn't exposed from the server. This patch tries to address it.

I also double-checked that all necessary fields exposed in the REST API endpoint with block types are included get_block_editor_server_block_settings call that is eventually going to be deprecated in favor of the former. See the list for reference:
https://developer.wordpress.org/rest-api/reference/block-types/

In the patch attached I also reordered the list of fields to match the REST API documentation.

Attachments (1)

52512.diff (1.0 KB) - added by gziolo 11 months ago.

Download all attachments as: .zip

Change History (4)

@gziolo
11 months ago

#1 @gziolo
11 months ago

  • Description modified (diff)

#2 @gziolo
11 months ago

  • Owner set to gziolo
  • Resolution set to fixed
  • Status changed from new to closed

In 50297:

Blocks: Add missing apiVersion field when preparing server-registered blocks for the block editor

When working on changes to @wordpress/create-block tool (https://github.com/WordPress/gutenberg/pull/28883) to use register_block_type_from_metadata with block.json file in the templates for scaffolded blocks I run into this issue where apiVersion wasn't exposed from the server.

Fixes #52512.

#3 @gziolo
11 months ago

In 50300:

Tests: Fix failing unit test for block settings

Follow-up to [50297].

Fixes #52512.

Note: See TracTickets for help on using tickets.