Add widget-areas endpoint#15015
Conversation
b73fb46 to
4722851
Compare
4722851 to
90d2a2a
Compare
There was a problem hiding this comment.
If we update some sidebar to use blocks, the sidebar_options structure is migrated in accordance with the RFC.
This causes some warnings on the existing widgets screen, these warnings may happen in production if the user downgrades to a previous WordPress version. On the same version even on the previous screen, this should not happen as we will implement functionality to handle the new structure even on the previous screen.

3ab833b to
4a2ec30
Compare
|
This PR was updated to be compatible with the current structure used by legacy widget block. It should load the sidebar widgets in the post editor using the legacy widgets block. |
22882cc to
56f0948
Compare
56f0948 to
b84a588
Compare
1868ca2 to
db638b0
Compare
db638b0 to
6c278e6
Compare
b84a588 to
5c878a6
Compare
bffaee5 to
79a8c57
Compare
347a161 to
6f67d60
Compare
noisysocks
left a comment
There was a problem hiding this comment.
Thanks for picking this back up! I left some comments. Looking forward to chatting with you about all of this later today. I think the big thing we need to think through is how updating existing legacy widgets should work.
| * | ||
| * @see WP_REST_Controller | ||
| */ | ||
| class WP_REST_Widget_Areas_Controller extends WP_REST_Controller { |
There was a problem hiding this comment.
We ought to add unit tests for all of this.
877c6b0 to
e333625
Compare
|
Hi @noisysocks, thank you for your review 👍 Your feedback was applied! |
e333625 to
73921f2
Compare
| * @param array $blocks Post Array of block objects. | ||
| * @return string String representing the blocks. | ||
| */ | ||
| function serialize_blocks( $blocks ) { |
There was a problem hiding this comment.
I think these serialize functions shouldn't be "official" functions we support, As far as I understand, they are only needed for the legacy block behavior. They can be local to that or at least mark them as unstable.
| * | ||
| * @since 5.7.0 | ||
| */ | ||
| class WP_Widgets_Manager { |
There was a problem hiding this comment.
I wonder if this should be marked experimental as well
youknowriad
left a comment
There was a problem hiding this comment.
What's blocking this @noisysocks @jorgefilipecosta I'd love to get a working prototype by the next Gutenberg release.
73921f2 to
66f4e2d
Compare
|
@youknowriad your comments were addressed. I'm not aware of any blocker and I think we just need the approval of the PR or additional feedback. |
Description
This PR uses the work done in #14251 with some adaptations to use CPT being implemented in #15014.
This is a step in a try to implement https://github.com/WordPress/gutenberg/blob/add/blocks-in-widget-areas-rfc/docs/rfcs/blocks-in-widget-areas.md
The CPT itself should be review in #15014.
How has this been tested?
I verified executing this code in the browser console:
Returns the widget areas with widgets being represented as legacy widget blocks.
During the first change, a post is created and the sidebar references that post:
This action is tottaly transparent to the user.