Make WordPress Core

Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#60403 closed enhancement (fixed)

General: Add `allowed_blocks` field to block types

Reported by: jsnajdr's profile jsnajdr Owned by: gziolo's profile gziolo
Milestone: 6.5 Priority: normal
Severity: normal Version: 6.5
Component: Editor Keywords: has-patch has-unit-tests add-to-field-guide
Focuses: Cc:

Description

There is a new block.json field called allowedBlocks, added in Gutenberg in https://github.com/WordPress/gutenberg/pull/58262. This is a companion patch to support this new field also on the server. It ensures that the following works:

  1. If the allowedBlocks field is defined in block's block.json, the objects registered in WP_Block_Type_Registry will have the allowed_blocks field.
  2. The allowed_blocks field is returned by the /wp/v2/block-types REST endpoint.
  3. The allowedBlocks field will be included in the boostrapped block registration data in the unstable__bootstrapServerSideBlockDefinitions inline script.

Change History (8)

This ticket was mentioned in PR #5988 on WordPress/wordpress-develop by jsnajdr.


10 months ago
#1

There is a new block.json field called allowedBlocks, added in Gutenberg in https://github.com/WordPress/gutenberg/pull/58262. This is a companion patch to support this new field also on the server. It ensures that the following works:

  1. If the allowedBlocks field is defined in block's block.json, the objects registered in WP_Block_Type_Registry will have the allowed_blocks field.
  2. The allowed_blocks field is returned by the /wp/v2/block-types REST endpoint.
  3. The allowedBlocks field will be included in the boostrapped block registration data in the unstable__bootstrapServerSideBlockDefinitions inline script.

Trac ticket: https://core.trac.wordpress.org/ticket/60403

@gziolo commented on PR #5988:


10 months ago
#2

allowed_blocks should be also explicitly defined in WP_Block_Type class.

jsnajdr commented on PR #5988:


10 months ago
#3

allowed_blocks should be also explicitly defined in WP_Block_Type class.

Done ✅

@gziolo commented on PR #5988:


10 months ago
#4

CI is unhappy about something. Other than that, I have enough to commit it tomorrow.

#5 @gziolo
10 months ago

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

In 57521:

Editor: Add allowed_blocks field to block registration and REST API

There is a new block.json field called allowedBlocks, added in Gutenberg in https://github.com/WordPress/gutenberg/pull/58262. This adds support for this new field also on the server.

Props: gziolo, jsnajdr.
Fixes #60403.

#7 @gziolo
10 months ago

  • Component changed from General to Editor
  • Keywords has-unit-tests added
  • Milestone changed from Awaiting Review to 6.5

#8 @stevenlinx
10 months ago

  • Keywords add-to-field-guide added
Note: See TracTickets for help on using tickets.