Uh oh!
There was an error while loading. Please reload this page.
Allow the style property of block.json to be an array and add support for object-based block styles - #2853
Allow the style property of block.json to be an array and add support for object-based block styles#2853adamziel wants to merge 27 commits into
Conversation
…assed_register_block_style_handle test
scruffian
commented
Jun 24, 2022
This seems like a blocker. Can we change it to allow for strings as well? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@scruffian oh it can be a string. I'm saying it can be either of:
Therefore, any code that assumes it's just a string or string[] will break. |
adamziel
commented
Jun 27, 2022
@scruffian I applied all the feedback and refreshed the related Gutenberg PR. This one is ready for another review! |
gziolo
commented
Jun 28, 2022
@adamziel, thank you so much for looking into adding native support for multiple
This will include also existing unit tests for both classes. New functionality requires also unit test coverage. I don't think we consume We should also extend the existing documentation for What is the reason this patch covers only |
Uh oh!
There was an error while loading. Please reload this page.
gziolo
commented
Jun 29, 2022
We will have to put an empty wordpress-develop/src/wp-includes/deprecated.php Lines 4305 to 4313 in 0abc2b2 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
gziolo
commented
Jun 29, 2022
It looks like we have everything covered so it needs a final review and a round of testing with and without the Gutenberg plugin. |
I think we're good now! GitHub CI seems to be down, though, so might be worth waiting until it's up again before merging. |
adamziel
commented
Jun 30, 2022
All the tests passed! Would you please help get this PR approved? CC @gziolo@aristath@scruffian@getdave |
adamziel
commented
Jul 4, 2022
@gziolo do you think you could merge this one? |
adamziel
commented
Jul 8, 2022
cc @mtias for soundness check – does this change seem reasonable to you? |
The example shared in the description looks nice in my opinion as it consolidates several available options. In the future, we could also use the same API borrowed from {
"styles": [
{
"name": "default",
"label": "Default",
"isDefault": true
},
{
"name": "other",
"label": "Other",
"settings": {
"border": { "color": {
"text": "#000",
"background": "#ccccc"
}
}
}
}
],
"style": [ "wp-block-button", {
"border": { "color": {
"text": "#fff",
"background": "#32373c"
}
}
} ]
} |
gziolo
commented
Jul 21, 2022
Let's land WordPress/gutenberg#41873 in the Gutenberg plugin first and give it a try before we include it in WordPress core. Code-wise everything is ready, and it had enough reviewers. We mostly need to validate that the extended API for |
adamziel
commented
Aug 19, 2022
I'm closing this in favor of #3108 |
What problem does this PR solve?
In WordPress/gutenberg#34180 we moved block CSS to
blockJson.supports.__experimentalStyle. This PR moves it underblockJson.styleat the root level. The goal is to only have a single location where styles are defined.Block.json before this PR:
Block.json after this PR:
This PR is an alternative to WordPress/gutenberg#41656
Other considerations
This is a breaking change – any existing code that assumes
styleto be a single item or an array of strings will throw a notice at best.Test plan
npm run buildcc @getdave@scruffian@draganescu
Trac ticket: https://core.trac.wordpress.org/ticket/56094