-
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
Section Styles: Register block style variations on init
#62461
Section Styles: Register block style variations on init
#62461
Conversation
Brings changes from WordPress/wordpress-develop#6756 to Gutenberg.
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 If 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/block-supports/block-style-variations.php ❔ phpunit/block-supports/block-style-variations-test.php |
// Trigger block style registration that occurs on `init` action. | ||
// do_action( 'init' ) could be used here however this direct call | ||
// means only the updates being tested are performed. | ||
gutenberg_register_block_style_variations_from_theme(); |
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.
Is it better to call the registration function direct here or call do_action( 'init' );
?
…62461) Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: annezazu <annezazu@git.wordpress.org>
I just cherry-picked this PR to the wp/6.6-beta-3 branch to get it included in the next release: d633a42 |
Fixes: #62303
What?
Moves registration of theme json provided block style variations from the
wp_theme_json_*
filters to theinit
action.Note: This brings the changes proposed in WordPress/wordpress-develop#6756 to Gutenberg.
Why?
How?
init
actionTesting Instructions
In the theme.json file of the theme, paste the following under styles.blocks.variations:
In the styles/ember.json (theme style variation) file, paste the following under styles.blocks.variations:
Create a new file called styles/partial.json (partial theme.json), and paste the following:
Screenshots or screencast
Screen.Recording.2024-06-05.at.6.49.43.PM.mp4
Screen.Recording.2024-06-05.at.6.50.31.PM.mp4