You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All of these would be readonly. As with the widgets endpoint, I suggest that rendered is not applicable to the REST API because a sidebar will have different content depending on the URL it is rendered onto.
Now, as for the actual list of widgets in a sidebar, I believe the representation should be just a list of widget IDs which would then allow the widgets assigned to a sidebar and their relative positions to be updated easily. The list of widget IDs can be exposed as a widgets property on the sidebar resource itself.
The sidebars endpoint should support returning the widgets among the _embedded, for example sidebars/:id:
Just to raise the issue we discussed about whether or not the REST API should be concerned with presentational information: do we want to return the class, before_widget, after_widget, before_title, and after_title params? Is this data that's stored in the database or registered dynamically with each page load?
I'm not sure whether these bits qualify as "data" or if they are merely convenient config params for template development that do not belong with the grouping resource we talked about.
Initial work on a read-only sidebar endpoint has been done at https://github.com/martin-pettersson/wp-rest-api-sidebars
A
sidebar
resource can look like:All of these would be
readonly
. As with thewidgets
endpoint, I suggest thatrendered
is not applicable to the REST API because a sidebar will have different content depending on the URL it is rendered onto.Now, as for the actual list of widgets in a sidebar, I believe the representation should be just a list of widget IDs which would then allow the widgets assigned to a sidebar and their relative positions to be updated easily. The list of widget IDs can be exposed as a
widgets
property on thesidebar
resource itself.The
sidebars
endpoint should support returning thewidgets
among the_embedded
, for examplesidebars/:id
:Note that the widgets belonging to a sidebar could also be queried via a
filter
param, such as:wp/v2/widgets?filter[sidebar]=sidebar-1
The text was updated successfully, but these errors were encountered: