-
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
Style engine: extend block support style definitions #45296
base: trunk
Are you sure you want to change the base?
Conversation
Size Change: 0 B Total Size: 1.51 MB ℹ️ View Unchanged
|
2a85fc4
to
a018edf
Compare
6872bfa
to
03bc1da
Compare
9754130
to
bb95fde
Compare
this commit adds a new class to the style engine that manages extensions of the block style definitions adding tests
- moving CSS style output tests to style-engine-test.php
Update var name
627d8a6
to
eb569b9
Compare
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❔ phpunit/style-engine/class-wp-style-engine-block-style-metadata-test.php ❔ lib/load.php ❔ phpunit/style-engine/style-engine-test.php |
By "too early" I mean that there's little demand for such a feature, and also that we should implemented and reach stability with global styles before we open up the extensibility genie.
What?
Takes inspiration from #41965
Adds a new class to the style engine that manages extensions of the block style definitions.
❗ This PR only allows setting new style definitions, that is, those that do not already exist in
BLOCK_STYLE_DEFINITIONS_METADATA
as either top-level style groups or their children. It does not allow overwriting existing definitions.Why?
Plugins and/or themes may want to register new a block support, and also have the Style Engine generate styles for this block support.
See: https://github.com/WordPress/gutenberg/blob/trunk/packages/style-engine/docs/using-the-style-engine-with-block-supports.md
Furthermore, allowing users to extend the default block style definitions list opens up handling of preset vars, classnames and other functionality.
TODO
This is the first iteration. Follow ups will:
value_func
callables.BLOCK_STYLE_DEFINITIONS_METADATA
How?
A new class:
WP_Style_Engine_Block_Style_Metadata
Testing Instructions
npm run test:unit:php:base -- --filter WP_Style_Engine_Block_Style_Metadata_Test
npm run test:unit:php:base -- --filter WP_Style_Engine_Test
You can also test manually, e.g,: