New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared/Reusable Blocks do not show when using the `allowed_block_types` filter #5893

Closed
paulwilde opened this Issue Mar 29, 2018 · 5 comments

Comments

Projects
None yet
5 participants
@paulwilde
Contributor

paulwilde commented Mar 29, 2018

If you limit the blocks which can be shown using the allowed_block_types filter then shared blocks do not appear in the 'Shared' block inserter tab.

@gziolo

This comment has been minimized.

Member

gziolo commented Apr 9, 2018

Closing in favor of #6070 which is duplicate but with a much detailed description. I consolidated those 2 into one :)

@gziolo gziolo closed this Apr 9, 2018

@noisysocks

This comment has been minimized.

Member

noisysocks commented Apr 10, 2018

I don't think it's a dupe. #5893 is referring to shared blocks not appearing in the inserter when allowed_block_types is set to false, whereas #6070 is referring to all blocks mistakenly appearing in the / command regardless of what allowed_block_types is set to.

@noisysocks noisysocks reopened this Apr 10, 2018

@noisysocks

This comment has been minimized.

Member

noisysocks commented Apr 10, 2018

Having said that, @paulwilde: could you elaborate on this a little more? Reproduction steps would be useful for making sure that we're all on the same page here.

My first impression is that this is expected behaviour. If one adds this to their lib/load.php:

add_filter( 'allowed_block_types', function() {
	return [ 'core/paragraph', 'core/image', 'core/quote' ];
} );

Then I would expect that shared blocks should not appear in any of the inserters, as we did not explicitly allow the core/block block type.

Conversely, if one adds this to their lib/load.php:

add_filter( 'allowed_block_types', function() {
	return [ 'core/paragraph', 'core/image', 'core/quote', 'core/block' ];
} );

Then I would expect that shared blocks will appear in the various inserters.

@paulwilde

This comment has been minimized.

Contributor

paulwilde commented Apr 10, 2018

Actually, this isn't a bug in that case. I didn't realise you had to add core/block for shared blocks to appear in the inserter. I figured that just whitelisting the block types would suffice for them to show up as shared blocks.

It might make sense for this fact to be added to the documentation to ease confusion. Also maybe the ability to create shared blocks should be disable if core/block isn't whitelisted?

@noisysocks

This comment has been minimized.

Member

noisysocks commented Apr 10, 2018

I didn't realise you had to add core/block for shared blocks to appear in the inserter

I mean, that's just what I think makes sense. Happy to be persuaded otherwise 😄

It might make sense for this fact to be added to the documentation to ease confusion. Also maybe the ability to create shared blocks should be disable if core/block isn't whitelisted?

👍 agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment