-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Support button's link settings for Pattern Overrides #58587
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core SVNIf you're a Core Committer, use this list when committing to
GitHub Merge commitsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/compat/wordpress-6.5/blocks.php |
Size Change: +40 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
2a33a4d
to
b799c2d
Compare
Flaky tests detected in b799c2d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7781362451
|
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.
LGTM, and it tests well. I'm not a huge fan of the markup it leaves when an override unsets one of the values:
<button href="https://wordpress.org" rel target />
However, I'm not sure much can be done about that right now, and I don't think it has any effect on the usability. Given the html is being manipulated dynamically, it's something that can be improved later on.
On that note, it might be worth following up with an issue to discuss the problem and what solutions there might be.
Also, just to check, @SantosGuillamot Are you happy for block binding support to be added for these attributes?
content[ blockId ].values[ attributeKey ] = | ||
block.attributes[ attributeKey ]; | ||
block.attributes[ attributeKey ] === undefined |
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.
It makes me a little nervous that this might have unintended consequences on other blocks, but it's not a big issue right now while there's a limited number of blocks supported.
An alternative could be maintaining a list of blocks and attributes near this code that this fix/hack should apply to.
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 think we can (and probably should) adjust this as we support more blocks. There's already a TODO comment below this line so I think it's enough for now?
FWIW, the HTML Tag Processor API does support a |
I believe is not that useful for other cases like "Post meta", but as long as it works for your use case, I believe it shouldn't be an issue to support them.
If I am not mistaken, the HTML API removes the attribute if the value is $value = _wp_array_get( $block_instance->context, array( 'pattern/overrides', $block_id, 'values', $attribute_name ), null );
return $value === '' ? false : $value; |
Backport WordPress/wordpress-develop#6072 |
What?
Part of #53705. Support both
linkTarget
andrel
ofcore/button
for Pattern Overrides.Why?
These attributes are editable in the UI but not saved in the overrides.
How?
Use an empty string to represent
undefined
for now until the block binding API supports a richer format.Testing Instructions
Added an e2e test.
Screenshots or screencast