Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#53332 closed defect (bug) (fixed)

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

Reported by: imath's profile 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 3 years ago.

Download all attachments as: .zip

Change History (15)

#1 @noisysocks
3 years ago

  • Milestone changed from Awaiting Review to 5.8

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


3 years ago

@imath
3 years ago

#3 follow-up: @imath
3 years 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 @kirasong
3 years ago

  • Focuses rest-api added

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


3 years ago

#6 in reply to: ↑ 3 ; follow-up: @hellofromTonya
3 years 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
3 years 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
3 years 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.

https://github.com/WordPress/gutenberg/pull/32726

Last edited 3 years ago by get_dave (previous) (diff)

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


3 years ago

#10 @get_dave
3 years ago

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

#11 @hellofromTonya
3 years ago

  • Keywords needs-docs removed

#12 @hellofromTonya
3 years ago

  • Keywords reporter-feedback added

#13 @imath
3 years ago

  • Keywords reporter-feedback removed

Thanks a lot @get_dave, sûre 👌

#14 @noisysocks
3 years 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.