Repository navigation
Make the list of widgets excluded from the legacy widget block extensible via a filter - #24271
Conversation
|
Size Change: -276 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
|
Why can't blocks add the transforms themselves? A block can declare a transformation from another block. Is the problem a lack of standard way to determine whether the Legacy Widget block's current widget matches a given block? Perhaps something similar to the |
That's right. Core and third party blocks can specify a https://developer.wordpress.org/block-editor/developers/block-api/block-transforms/#block Does that cover all the use cases @adamziel? |
|
@noisysocks with that from transformation added can we map which blocks to which widget it replaces so that the legacy widget does list it in its option? This was suggested in the code of our widgets modifications to support the legacy widget block. |
|
🤦 of course you are right @ZebulanStanphill, this is all that has to be declared that, let's say', a navigation block should be offered as a transform option on custom HTML legacy widgets: It seems like this PR could just remove this comment then. @noisysocks do you happen to know why was the |
|
I think the idea is that:
So therefore we hide the Core widgets from that dropdown menu. It makes sense that we should let third parties disable their widgets from appearing in the dropdown, too. |
Yes, this. Does the transformation API aromatically achieve this goal? |
No it does not. We should add an Also |
That is why I think this PR should not be about removing a to do but instead about adding that filter to make that array extensible by third parties. cc @adamziel |
|
@draganescu thanks for the ping, this discussion is absolutely on my radar and I will get back to it this week :-) |
|
@noisysocks @draganescu I updated the PR using the exact name proposed by @noisysocks ( |
8de2a9a to
d1adfd5
Compare
|
@noisysocks Thanks for clarifying what was supposed to be going on here. Yeah, it definitely makes sense to have a filter for plugins to hook into to prevent users from inserting their legacy widgets through the Legacy Widget block when native block equivalents are available. |
noisysocks
left a comment
There was a problem hiding this comment.
The name makes me miss Objective-C with its very accurate and long method naming 😂
Description
This PR adds the
widgets_to_exclude_from_legacy_widget_blockfilter to enable plugins and themes to add/remove their own widgets from the legacy widget block:It also removes a misleading @todo comment from lib/widgets.php. The feature described in that comment can be achieved by using the transform API that already exists: