-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use block context to detect presence of parent pattern for overrides #62861
Merged
SantosGuillamot
merged 6 commits into
fix/aspect-ratio-not-working-in-image-with-overrides
from
try/pattern-overrides-using-context
Jun 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
320dcb9
Use block context to detect presence of parent pattern
talldan 214a2a2
Regenerate fixtures
talldan 318cc7b
Update image block to use context for checking a parent pattern block…
talldan 14be2c2
Rename context to `pattern/overrides` to be consistent with php code
talldan b8b3733
Move pattern overrides context shim to pattern overrides hooks
talldan eb486e8
Remove shim
talldan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this to the
usesContext
property when registering the pattern overrides source?gutenberg/lib/compat/wordpress-6.6/block-bindings/pattern-overrides.php
Line 57 in 320dcb9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this also register
usesContext
for client side code?Considering both
pattern/overrides
andpatternOverridesContent
are both sharing the same attribute via context, I guess they should be named the same thing. I'm not enamoured with usingpattern/overrides
naming in js code where the variable is often accessed via dot notation or destructuring.I think changing it would require a backport.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not, I think it could still be moved to this file if we change it over to the
registerBlockType
hook similar to the one in theuse-binding-attributes.js
file:https://github.com/WordPress/gutenberg/blob/trunk/packages/editor/src/hooks/pattern-overrides.js#L110
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it should work client-side. We might make some changes to how it is handled, but it should work.
I'm not familiar with how that context is used, but it'd be great to use just one property if possible.
Yes, I think it would need one. But it should be just one line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to change it to
pattern/overrides
on the client as well, so that it's consistent and we won't need a backport.I think I've addressed all the feedback.