WordPress.org

Make WordPress Core

Opened 6 months ago

Closed 6 months ago

#53332 closed defect (bug) (fixed)

Transforming a Legacy Widget to a Block Widget is not possible in WP 5.8

Reported by: imath Owned by:
Milestone: 5.8 Priority: normal
Severity: normal Version:
Component: Widgets Keywords: has-patch
Focuses: docs, rest-api Cc:

Description

Hi,

I'm currently working on migrating BuddyPress legacy widgets to BuddyPress Blocks to anticipate the introduction of the Widgets Block Editor into WordPress 5.8.

This documentation page is explaining the steps to allow migrating a Legacy Widget to a Block one. I've applied it and it's working fine using the Gutenberg plugin (10.7.1) in WP 5.7.2 as shows the following screen capture :

https://cldup.com/9Ki9SucsM4.png

But as soon as I switch to WordPress trunk (5.8) (having the Gutenberg plugin deactivated), the list of transformations doesn't include anymore the BP Block. Here's a screen capture of the result in 5.8:

https://cldup.com/-8wku15-ws.png

Attachments (1)

53332.patch (1.9 KB) - added by imath 6 months ago.

Download all attachments as: .zip

Change History (15)

#1 @noisysocks
6 months ago

  • Milestone changed from Awaiting Review to 5.8

This ticket was mentioned in Slack in #core-test by johnbillion. View the logs.


6 months ago

@imath
6 months ago

#3 follow-up: @imath
6 months ago

  • Keywords has-patch added

I've found the reason why. While the documentation page and the Gutenberg plugin are using the Widget's class $show_instance_in_rest property. WordPress decided to stop checking this property into the Widgets REST endpoints in favor of looking into the $widget_options['show_instance_in_rest'] property.

53332.patch is fixing my issue. The patch is a kind of back compatibility mechanism for early testers who got used to the $show_instance_in_rest property.

If you think it's not needed, I'd advise to at least update this documentation page (to avoid misleading developers) to explain people now need to include a $widget_options['show_instance_in_rest'] = true when registering their widget.

#4 @mikeschroder
6 months ago

  • Focuses rest-api added

This ticket was mentioned in Slack in #core by desrosj. View the logs.


6 months ago

#6 in reply to: ↑ 3 ; follow-up: @hellofromTonya
6 months ago

  • Focuses docs added
  • Keywords needs-docs added

Replying to imath:

I've found the reason why. While the documentation page and the Gutenberg plugin are using the Widget's class $show_instance_in_rest property. WordPress decided to stop checking this property into the Widgets REST endpoints in favor of looking into the $widget_options['show_instance_in_rest'] property.

@imath thanks for chasing down and identifying the problem.


Replying to imath:

If you think it's not needed, I'd advise to at least update this documentation page (to avoid misleading developers) to explain people now need to include a $widget_options['show_instance_in_rest'] = true when registering their widget.

The docs do need to be updated, which can be done upstream in the Gutenberg repo.

What about the patch?

As this is a new feature that hasn't shipped yet, I'm concerned about adding code. Why? The added code has to be maintained in core and could confuse both extenders and contributors.

#7 in reply to: ↑ 6 @imath
6 months ago

Replying to hellofromTonya:

What about the patch?

As this is a new feature that hasn't shipped yet, I'm concerned about adding code. Why? The added code has to be maintained in core and could confuse both extenders and contributors.

Well, I'm fine with not using the patch. Now I know we need to look into the $widget_options['show_instance_in_rest'] property to have the transfom function working in WordPress 5.8.

But, the feature already shipped into the Gutenberg plugin and just like me, there might be people already using the transform feature that might be confused like I was to see the transform function is no more working.

#8 @get_dave
6 months ago

If it hasn't been completed, I'll sort out the developer documentation upstream now whilst we're waiting for a decision on the patch.

[Here is the upstream PR for docs changes](https://github.com/WordPress/gutenberg/pull/32726).

Version 2, edited 6 months ago by get_dave (previous) (next) (diff)

This ticket was mentioned in Slack in #core-editor by desrosj. View the logs.


6 months ago

#10 @get_dave
6 months ago

Documentation has been updated in Gutenberg Core. Do you feel we can close this out now @imath?

#11 @hellofromTonya
6 months ago

  • Keywords needs-docs removed

#12 @hellofromTonya
6 months ago

  • Keywords reporter-feedback added

#13 @imath
6 months ago

  • Keywords reporter-feedback removed

Thanks a lot @get_dave, sûre 👌

#14 @noisysocks
6 months ago

  • Resolution set to fixed
  • Status changed from new to closed

Thanks for updating the docs @get_dave. Marking this as fixed.

Note: See TracTickets for help on using tickets.