Add context property mapping to block registration#23180
Conversation
|
Size Change: 0 B Total Size: 1.13 MB ℹ️ View Unchanged
|
ockham
left a comment
There was a problem hiding this comment.
Works like a charm! Thanks Noah 🙇
|
trying to get the tests to pass. it shouldn't be related at all |
|
wtf travis |
| $property_mappings = array( | ||
| 'title' => 'title', | ||
| 'category' => 'category', | ||
| 'context' => 'context', |
There was a problem hiding this comment.
I guess we need to add providesContext, too :)
|
@ockham Why wasa this merged. Either of the REST API team signed off and this change is wrong. REST API already has a context value and can be used for something else. |
|
At the moment, it's correct since Gutenberg relays on |
My apologies, I might not be very familiar with this code, but the fix seemed to make sense and fixed the issue we were seeing. I also wasn't aware it affected the REST API, or that it needed sign-off by the REST API team. Could you elaborate why the change is wrong, and what policy we should observe with regard to sign-off by individual teams? |
Travis passed and this fixes a bug where blocks would not render on the front end if they relied on block context. (the change which introduced the property mapping mechanism basically stopped a block from registering the context it needs.) So it's more of a hotfix :) Maybe we need more strict checks to make sure that PRs affecting API are not merged without sign-off from the API team? |
|
So what's the follow-up here? It looks like we might need to:
|
|
@spacedmonkey name fixed in #23212 |
Fixes #23179
Description
Block context was not being parsed in block registration.
This broke dynamic blocks which relied on
$block->context. The context properties were not being added to context from available_context because it only adds properties which existed in the block metadata... and context was not parsed inHow has this been tested?
Locally.
Screenshots
Before:
After: (ignore the echo; it was for debugging)
Types of changes
Bug fix
Checklist: