Skip to content
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

Stabilize the pattern overrides block context #58102

Merged
merged 6 commits into from
Jan 23, 2024

Conversation

talldan
Copy link
Contributor

@talldan talldan commented Jan 23, 2024

What?

This PR stabilizes the pattern overrides block context, and partially removes the pattern overrides experiment.

Four core blocks are currently supported for pattern overrides, and the code in lib/block-supports/pattern.php previously added a way for those blocks to useContext when the pattern experiment was active. In this PR I'm instead adding the useContext declarations directly to the block.json files.

Why?

This should help with:

  • Backports to core - the code in the pattern.php file no longer needs to be backported, the blocks wil be automatically updated in core along with package updates.
  • Removing the pattern overrides experiment flag - the flag will be removed as part of shipping the feature in WordPress 6.5. The feature can also be released in Gutenberg 17.6, though this will require also removing the block binding experiment.

Testing Instructions

  • Test patterns with the 'Pattern overrides' experiment turned off
  • Test patterns with the 'Pattern overrides' experiment turned on (see instructions here)

Both should work the same as in trunk.

@talldan talldan added the [Type] Code Quality Issues or PRs that relate to code quality label Jan 23, 2024
@talldan talldan self-assigned this Jan 23, 2024
@talldan talldan added the [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced label Jan 23, 2024
@talldan talldan changed the title Update individual blocks to use pattern context Update individual blocks to use pattern overrides context Jan 23, 2024
Copy link

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/load.php

@talldan talldan changed the title Update individual blocks to use pattern overrides context Stabilize the pattern overrides block context Jan 23, 2024
Copy link

github-actions bot commented Jan 23, 2024

Flaky tests detected in c8ca2e9.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7622686822
📝 Reported issues:

@talldan talldan force-pushed the update/individual-blocks-to-use-pattern-context branch from aca9b90 to cd183cc Compare January 23, 2024 07:06
Copy link
Member

@kevin940726 kevin940726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested well and code looks good! 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add the overrides attribute in block.json or should we do in #58105?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I did make that change but reverted it accidentally, I'll bring it back again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in c8ca2e9

@talldan talldan merged commit c6ac9c0 into trunk Jan 23, 2024
55 checks passed
@talldan talldan deleted the update/individual-blocks-to-use-pattern-context branch January 23, 2024 08:49
@github-actions github-actions bot added this to the Gutenberg 17.6 milestone Jan 23, 2024
@getdave
Copy link
Contributor

getdave commented Jan 26, 2024

@talldan I saw you noted that patterns.php has been removed. So we're good on this PR in terms of backports for 6.5?

@talldan
Copy link
Contributor Author

talldan commented Jan 30, 2024

Yep, I think we managed to move all the logic into block code, apart from the registration using the block binding API, but there's the block bindings backport PR that handles that.

@getdave
Copy link
Contributor

getdave commented Jan 30, 2024

✅ I updated the PHP Sync Tracking Issue for WP 6.5 to note this PR does not require a backport for WP 6.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants