-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Parse (area-specific) context in template-part block. #47203
Conversation
@Mamaduka Can you take a look at this? Apologies for asking that again (especially after we now already backported a few package updates in https://core.trac.wordpress.org/changeset/55079 🤦♂️), but if this is good to go, is there any chance that we can backport it soon? Unfortunately it blocks the same core PR WordPress/wordpress-develop#3560. To be fair, since we're not far from 6.2 beta, can you tell me when the regular package update would happen for core? Maybe that would be enough. Anyway, first of all please take a look at the PR :) |
Flaky tests detected in 55abfe5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3946945642
|
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.
Thanks for the ping, @felixarntz.
To be fair, since we're not far from 6.2 beta, can you tell me when the regular package update would happen for core? Maybe that would be enough.
Technically we can start doing regular package releases for the 6.2 beta after Gutenberg 15.1 RC is released. It's scheduled for next week. I can ensure we merge this update before RC so it's included in the initial package updates PR.
We also have a similar issue with the Cover block when it's used as a featured image. It might be a good idea to patch it as well.
@Mamaduka I reviewed the issue, tested it, and left a reply. Please take a look. For context, the core ticket https://core.trac.wordpress.org/ticket/56930 already covers the part of the issues reported that is realistic to cover at this point. There is one issue there that remains ( In other words, this PR should be good as is. It would be great if we could get it into the Gutenberg 15.1 RC release. |
Thank you, @felixarntz! I'll make sure to get this merged before 15.1 RC, more likely before the end of the week. |
@Mamaduka Friendly ping here. Just want to make sure this isn't forgotten :) |
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.
This looks great.
I believe WordPress/wordpress-develop#3560 will need a refresh to use the updated context name.
What?
Similar to #45534, this PR is part of the solution from WordPress/wordpress-develop#3560, which addresses https://core.trac.wordpress.org/ticket/56930. We need to pass the
$context
parameter towp_filter_content_tags()
in thetemplate-part
block.Why?
We should always pass a context parameter to
wp_filter_content_tags()
, except when there is a current filter running. This is not the case when parsing the block template though, which is why WordPress/wordpress-develop#3560 already takes care of it for the overall template. It also does so for thetemplate-part
block, however since that can only be edited within upstream Gutenberg, I have opened this PR.Including the template part area identifier is useful context for that function, as it can make different decisions based on that. For example, images in the header of a site are extremely likely to appear above the fold, while for images in the footer the opposite applies.
How?
The implementation here goes a bit beyond the core PR WordPress/wordpress-develop#3560, using a cleaner implementation: We should ensure that the
$area
string is one of the allowed area identifiers before passing it through in the context.Testing Instructions
Test this as part of WordPress/wordpress-develop#3560:
header
template part with an image in it.footer
template part with an image in it.