Skip to content
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

Automatically remove block patterns if one or more of the blocks has been unregistered using unregisterBlockType #23803

Closed
Tracked by #31153
philbuchanan opened this issue Jul 8, 2020 · 5 comments
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced Good First Issue An issue that's suitable for someone looking to contribute for the first time [Type] Enhancement A suggestion for improvement.

Comments

@philbuchanan
Copy link

philbuchanan commented Jul 8, 2020

If a block has been unregistered with unregisterBlockType(), patterns that use that block still show up in the "Patterns" tab of the block inserter. It shows an error message on the preview as well as when adding that pattern.
It would be great if patterns that include a block that has been unregistered were automatically unregistered themselves (with register_block_pattern()).

Screenshots

Screen Shot 2020-07-08 at 4 29 52 PM

Editor version

  • WordPress version: 5.4.2
  • Gutenberg plugin version: 8.5.0

Additional Context

I have a plugin that replaces the default columns block with a much more powerful version. I unregister the built in core/columns block so I don't confuse users with multiple blocks with the same name.

@carolinan carolinan added the [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced label Jul 9, 2020
@priethor priethor mentioned this issue Apr 23, 2021
22 tasks
@jordesign
Copy link
Contributor

@priethor Can I please get a gut check. It sounds like (based on the below comment from #26607) that this may be resolved now?

I'm not sure what I was thinking, but this is all possible via the block_editor_settings filter, which has been there all along. :)

@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Aug 24, 2023
@priethor
Copy link
Contributor

@jordesign, as far as I understand, the filter doesn't solve this particular issue automatically, as you still need to disable the patterns apart from the blocks. However, there have been many recent changes in patterns, and it would be good to double-check whether this condition is already managed automatically or the issue still persists.

@priethor priethor added the Needs Testing Needs further testing to be confirmed. label Aug 25, 2023
@qoorus
Copy link

qoorus commented Feb 28, 2024

スクリーンショット 2024-02-28 20 59 22

I tested it on WordPress 6.4.3 and was able to reproduce it.
I think this error message is necessary.
This is because if you unregister a block and then register it again, if it has disappeared from the pattern, it becomes impossible to fix.

@youknowriad
Copy link
Contributor

I don't think we should be unregistering the patterns automatically. There's a lot of different reasons for the block to not be available but maybe we should hide the message in "preview mode".

@youknowriad youknowriad added Good First Issue An issue that's suitable for someone looking to contribute for the first time and removed Needs Testing Needs further testing to be confirmed. labels Jul 15, 2024
@youknowriad
Copy link
Contributor

I found that this is a duplicate of #31706 which has more discussion in it. So I'm closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced Good First Issue An issue that's suitable for someone looking to contribute for the first time [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

6 participants