[wp-trac] [WordPress Trac] #28093: Add REST API endpoints for widgets and sidebars

WordPress Trac noreply at wordpress.org
Thu Nov 23 06:31:13 UTC 2017


#28093: Add REST API endpoints for widgets and sidebars
-------------------------+-----------------------------------
 Reporter:  westonruter  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Widgets      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:  javascript, rest-api
-------------------------+-----------------------------------

Comment (by westonruter):

 Blocks do have a UI component, but they also have a schema. A block has
 attributes/properties just as a widget instance does. A block is richer in
 that it can define sources for these attributes outside of just a JSON
 object but rather can refer to data in HTML, postmeta or eventually other
 sources as well. Widgets indeed do have a crappy storage mechanism in
 serialized options with an equally crappy way of identifying a widget with
 via a `{type}_{number}` “ID” (like `text-123`) which is totally different
 from how everything else in WordPress is identified: creating a new widget
 instance ID relies on grabbing the max index of all current array indexes
 for a given type and then adding one; this makes them very prone to
 concurrency collisions. Widgets need to move to using auto-incremented IDs
 just as posts use… or better, a UUID like Customizer changesets use.

 The `wp_block` post type in Gutenberg uses UUIDs for IDs and this is how
 they are accessed via the blocks endpoint:
 https://github.com/WordPress/gutenberg/blob/13c7c99e17fe8c6b1bee78d43a24e1e805b723c4/lib
 /class-wp-rest-reusable-blocks-controller.php#L282-L316

 Nested blocks are on the horizon for Gutenberg, and this is essentially
 what a widget sidebar or nav menu can be considered: reusable blocks that
 contain an ordered list of widgets or nav menu items.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28093#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list