Inserter: Restrict unallowed block types more broadly#4097
Inserter: Restrict unallowed block types more broadly#4097
Conversation
|
@aduth what is the current status of this one? Should we also consider filtering based on the category name? |
|
The status of this is that it lacks reviews 😄
Can you clarify what you mean by this? |
|
Will rebase the branch shortly to resolve conflicts. |
|
References to a few commits which are planned to be dropped in rebase:
|
b88af3a to
40bb47b
Compare
|
We recently introduced this new function which registers all core block. Can we move now filtering there? |
It should be better since I discovered it :)
Yes, so every block has this category type specified. There is another PR open when they propose to make it possible to add custom categories to group 3rd party blocks. I was wondering if we could allow to limit blocks registered based on this value. Let’s say I want to have all blocks that have category embeds or widgets. It’s similar to this filtering but based on a different block’s field. I hope it’s better explained now. |
|
If we move ahead with something like #4769 then we won't need the changes that this PR makes to
This is a good idea. We could just never register a block if it's disabled. |
|
Wrong button 😅 |
I should read this earlier :P Sorry about that. However, I still feel that we should discuss if it makes sense to register all blocks and only filter them in UI. Unless there is a reason to register all blocks even in the case when they can't be selected. /cc @mtias |
|
We'll need to address this, though ideally not in a way which is scattered across the various implementations. Some ideation at #6067 (comment) and #6067 (comment) . |
Closes: #3990.
Related: #4091
This pull request seeks to broaden the application of the
allowed_block_typesto apply more universally. Prior to these changes, if a block type was not allowed, it would still be surfaced in:Implementation notes:
I debated between the approach here (where each component is responsible for checking allowed block types) and something more low-level where the block types themselves would not be registered. I decided in this direction because "allowed types" is arguably an editor setting, selecting from the totality of block types registered.
Testing instructions:
Ensure tests pass:
Verify that restricting allowed block types is reflected in the above-listed behaviors.
Example change: