-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Migration path for widgets to blocks for plugin and theme authors #30919
Comments
This already exists via block transforms. If a plugin sets This has already been done for all core widgets that have a block equivalent: So, I don't think any development work is required here. We definitely need to document the steps I described above, though, so that third party plugin developers have an easy to follow guide. Perhaps also the UI should be more prominent? We could e.g. display a "Convert to blocks" button in the toolbar when we see that a block transform exists from |
Ha, indeed, should have checked and yes block transforms is the better approach than patching widget registration, doh!. I'll split a documentation task from this issue around transforming plugin provided widgets to blocks. UI wise, I believe the transform menu to be a very power-user thing. |
It's an item in #25759. But maybe seperate issues would be better instead of one big issue with checkboxes.
Yes I don't think this bit of the UI is as prominent as it needs to be. (Even you missed it! 😛) A "Convert to blocks" button on every Legacy Widget block makes sense to me. |
Closing this as we have:
|
As one of the goals of introducing blocks to widget areas is to create a kind of stepping stone for block based themes adoption and classic theme migration, a mechanism that is aimed at moving away from widgets should be provided. Therefore I propose that we:
Implement a way for plugins to convert the widgets they provide to alternative blocks they recommend.
Mechanism description:
LegacyWidget
block should offer a "Convert to blocks" button, similar to the one that theClassicEditor
block provides.LegacyWidget
block "Convert to blocks" button only appears if the widget has a specified migration plan.WP_Widget
and a new argument forwp_register_sidebar_widget
)That is all plugins should do: update their
register_widget
andwp_register_sidebar_widget
calls withe migration path, then the system should automatically provide the conversion mechanism.As an extra feature, plugins should also be able to specify if they want a widget to be converted to a "best approximation". The best approximation conversion effectively turns the rendered widget html to blocks. The usefulness of this is debatable, but users may want to opt out of a widgets' functionality while keeping the content they created.
Core should be the 1st to implement this migration strategy and provide the block migration plan for all core widgets that already have block equivalents.
In the future this mechanism can be used for a one way import of widget areas into template parts for a block based theme.
The text was updated successfully, but these errors were encountered: