Skip to content

Blocks should only be able to be transformed into other allowed blocks.  #6363

@jasonbahl

Description

@jasonbahl

Issue Overview

If you define a list of "allowed_blocks" via this filter: https://github.com/WordPress/gutenberg/blob/a1055928b76718dc363be410ad6b2f00ff367c2c/docs/extensibility/extending-blocks.md#hiding-blocks-from-the-inserter

The blocks are filtered out of the inserter, but the "Transform Into" option allows you to transform into any block still.

I think the expectation would be for the transform into option to also respect just the allowed blocks.

Steps to Reproduce (for bugs)

  1. Use the filter allowed_block_types to just filter support for a single block type:
add_filter( 'allowed_block_types', function( $allowed_block_types, $post ) {
	return [ 'core/paragraph' ];
}, 10, 2 );
  1. Add a paragraph block
  2. Click "More Options" on the block
  3. See other "non-allowed" blocks you can transform into

Expected Behavior

  1. Use the filter allowed_block_types to just filter support for a single block type:
add_filter( 'allowed_block_types', function( $allowed_block_types, $post ) {
	return [ 'core/paragraph' ];
}, 10, 2 );
  1. Add a paragraph block
  2. Click "More Options" on the block
  3. Only see blocks that are "allowed", if any

Todos

  • Tests
  • Documentation

Metadata

Metadata

Labels

[Feature] BlocksOverall functionality of blocks[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions