-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Legacy Widget: Add "Convert to blocks" button #25100
Comments
As mentioned in that original issue that I created (#15911), it's not good enough to simply transform a legacy Text Widget into a Paragraph Block. In fact, it's impossible to do so. A widget is more than just the main content, it's also a header, and in the case of a Text Widget, it may be one or more Paragraphs of content. Since you only allow 1 paragraph per Paragraph Block, it's simply not possible to convert a single legacy Text Widget into a single Paragraph Block. You would need to transform it into one Heading Block, and one or more Paragraph Blocks. It may even be better to transform it into a Heading Block and a Classic Block, that way you wouldn't need to split the content into multiple paragraph blocks. Likewise with any of the existing widgets. You need one Heading Block, and some other block. You can't simply ignore, or forget about the headings in the legacy Widgets. This is one of the items I also mentioned as well, in regards to this whole widgets UI. Having to add multiple blocks, just to replicate one widget in the classic Widgets screen, is making it a LOT harder for people to migrate to the new Widgets screen, and also makes it significantly harder to maintain going forward. I've now gone from 5 simple widgets, to a minimum of 10 blocks, and in some case, it could be 15 or 20 blocks. This is not making WordPress easier to manage for users. |
Thanks for flagging @maddisondesigns. Perhaps instead of adding a Paragraph transformation we need to add a Convert to blocks button similar to what the Classic block has. |
@mapk: Does adding Convert to blocks to the Legacy Widget block's toolbar when the widget is a Text widget make sense to you? |
@noisysocks Having a Convert to blocks button sounds like a really good idea 👍 |
Yes! I'd love a way to easily convert widgets (that can be) to blocks! In this way the Legacy Widget block aligns with the Classic block. Maybe the naming should also align? Classic Widget block ? Let's also make sure that button doesn't show up unless it's possible to convert, right? I would imagine it looking similar to this: |
Just to confirm @mapk @noisysocks - is this issue about adding "Convert to blocks" button to the "Legacy Widget block of type text widget"? Or to "all legacy widget blocks that are possible to transform to another block"? If it's the latter - it would be pretty much the same as the existing "Transform" dropdown, only more identifiable.
I don't quite follow @noisysocks - would you mind elaborating? My thinking is that converting the widget to a heading and a paragraph block using a new kind of button would be essentially working around the limitations of transformations, no? If we add that button to one legacy widget, it would only make sense to add it to all other legacy widgets for consistency. Couldn't we just improve transformations and make the transform button more visible? Or convert it to a group of blocks? |
@adamziel, the "Convert to blocks" button is a existing pattern used on the Classic block. Classic block I believe the proposal here is to mimic this behavior for widgets that have a block equivalent and can easily be converted to blocks. It's different from a transform, IMO. |
@mapk thank you for providing the classic block example! While I think I understand the idea, it feels a little confusing to me:
I think we should just enhance transforms to support the missing use-case. Labeling the transform button to "Convert to blocks" could be a nice UX touch on the legacy block. I'd love to hear more opinions here too, cc @youknowriad @noisysocks @draganescu @talldan @tellthemachines |
One more note - I imagine for most widgets "Convert to blocks" would apply the first available transform. Text widget is the one case we know about where it would do something different. Unless it's only enabled for the text widget? 🤔 I also imagine it should be extendable by plugin authors. |
So the thing I see here is that transform should be available if the widget developer (including core) provided such a transform, where the legacy widget block is transformed to another proprietary bloc (say Astra address widgets to Astra address block). A convert to blocks option would mean (to me at least) a generic attempt to convert the widget's rendered html to a series of blocks, like we do with the classic block conversion to blocks. I am not sure this is entirely possible though as some widgets render with contextual information. |
I believe @draganescu is correct here. A "Transform" is a 1:1 block transform – a block is transformed into another block. A "Convert" is converting non-blocks (could be many elements) into corresponding blocks. That's how I understand it. I'm fairly certain this same conversation must have come up about the Classic Editor block. I wonder if the reasoning for the decision to add a "Convert to blocks" button would be helpful here? |
Definitely agree that transform and convert are technically two different concepts. Whether they're treated as different concepts in the UI is another story. How can we move this one specific issue forward? I think the simplest path is to add Convert to blocks to only the Text widget. This mirrors the behaviour of the Classic block. |
Let's start with this and iterate. |
Split out from #15911.
It's not currently possible to transform a legacy Text widget into a Paragraph block.
Steps to reproduce:
/wp-admin/widgets.php
by manually entering the URL into your browser.Expected result:
An option to transform the widget into a Paragraph block should appear.
Actual result:
Only an option to transform the widget into a Group block appears.
The text was updated successfully, but these errors were encountered: