Closed swissspidy closed 6 years ago
Right now, Ajax_Handler
handles two cases:
POST
requests for updating the menu. Depending on the type
, it updates the trashed menu or the regular menu. Data is sent as an array with two sub-arrays menu
and submenu
. Ajax_Handler::update_menu_loop()
converts the data before storing.DELETE
requests cause delete_user_option()
to be called. Again distinguishing the type
of menu.It's mainly this way because Backbone.Collection
natively supports this.
The REST API doesn't really allow modifying collections, just individual objects (menu items). That's not very useful for our use case, so we'd need to think about how to best leverage the REST API.
The new plugin requires WordPress 4.4 and PHP 5.4, so why not use the REST API for saving and retrieving the admin menu? I think that would make for a very interesting project which WordPress core could theoretically also benefit from.