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
I searched about this quite a bit and couldn't find any leads so the final resource was to ask here. What's the proper way of using objects in attributes? Currently I'm using like this:
With regard to your question you could provide more structure to the object definition by using a query source (there is an example in the block attributes query section).
It's not possible to add type information if the object is saved to the default block comment (as above in your example), and you will need to verify the object yourself.
The alternative is that you split the object out into separate attributes (this is what core blocks mostly do), with each attribute specifying the type. That is, in your example you would have 3 attributes - global, tablet, and mobile - each of which is a boolean.
Hey,
I searched about this quite a bit and couldn't find any leads so the final resource was to ask here. What's the proper way of using objects in attributes? Currently I'm using like this:
But is there a more structured way with array attributes, similar to how REST API handles objects https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#objects?
Sorry for bugging here.
The text was updated successfully, but these errors were encountered: