[wp-trac] [WordPress Trac] #28093: Add REST API endpoints for widgets and sidebars (was: Widgets JS API)

WordPress Trac noreply at wordpress.org
Wed Jan 4 06:08:58 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
-------------------------+-----------------------------------
Changes (by westonruter):

 * keywords:  needs-patch reporter-feedback => needs-patch
 * focuses:  javascript => javascript, rest-api
 * milestone:  Awaiting Review => Future Release


Old description:

> There is currently no unified JS API for managing widgets (nor is there
> an API in PHP). Any widget manipulation requires a lot of manual Ajax
> calls and reverse engineering of how the widgets admin UI manages
> widgets.
>
> The widgets admin UI needs a rewrite to utilize Backbone. The 3.9 work on
> bringing widget management to the customizer introduced some use of
> Backbone there, but the underlying Backbone logic should be abstracted so
> that it is suitable for use on the widgets admin page, as well as in the
> customizer (not to mention elsewhere, such as a TinyMCE view!)
>
> Related:
>
> * #27151 Live search of available widgets
> * #16613 Extend Widget API to allow sidebar/widget manipulation

New description:

 There is currently no proper client-side API for managing widgets and the
 sidebars they belong in (and any APIs in PHP are also lacking, per
 #16613). Any widget manipulation requires a lot of manual Ajax calls and
 reverse engineering of how the widgets admin UI manages widgets.

 The implementation of normalized REST API endpoints could coincide with
 re-architecture of how widgets are stored by making use of a custom post
 type instead of storing widgets in options. See #35669.

 The way that widgets and sidebars are represented needs to be formalized
 and normalized in REST API endpoints (ideally in conjunction with nav
 menus).

 Potentially any endpoints for widgets could be abstracted away as “content
 blocks”, such as with #33473 (Shortcodes + Widgets + Nav Menus. Unified
 "component" API (aka Content Blocks))

 See discussion at https://github.com/WP-API/WP-API/issues/19

 (Originally this ticket also described a JS API in front of any Ajax/REST
 interface to facilitate the manipulation of widgets and sidebars, but the
 scope is now limited specifically to the REST API and any JS interface can
 be part of the WP-API Backbone JS Client.)

--

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


More information about the wp-trac mailing list