-
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
How to filter block_editor_settings & global styles settings #30082
Comments
In a conversation with @youknowriad one option we discussed was to do:
For themes without theme.json support, we'll still pass the settings to the editor in the new format. We'll just use the old theme_supports to prepare them. |
I believe the proposal I lean towards is the following:
Also, take this context argument as an opportunity to solve the issue above by doing this in edit-form-blocks.php: In edit-form-block
|
I was thinking of the changes coming at #29891 Also that we now store the theme.json settings under the What if we stored this differently in
This would make it so that we only add changes, so it's back-compatible. Porting to WordPress core means that the global styles code that wrangles the settings is ported to edit-form-blocks.php before we run the |
We still need to run the hook after we add those new settings for folks that want to alter these new settings. The proposed changes make sense though but let's keep it for later (to be able to keep the |
I was thinking about that when exploring WordPress/wordpress-develop#1118. It looks like the simplest way to keep the backward compatibility is to introduce another hook that is context-aware like: Similar to this https://developer.wordpress.org/reference/hooks/render_block_this-name/. So the plan you outlined makes sense 👍🏻 |
According to the latest work, it looks like the next steps for this are:
By doing the above, we are changing how the current global settings work: from being the last to being the first. I now think this is how it should work: that the theme configures the settings via How does this sound? |
I think we are aligned, let's make it happen 👍🏻 |
Going to close this one as per WordPress/wordpress-develop#1262 |
In the server, there's a filter named
block_editor_settings
that is used to allow 3rd parties to hook into the settings passed to the post editor. It's not clear yet if the other editors should use this as well (site editor, widgets editor, etc) ― edit: some clarity about this at WordPress/wordpress-develop#1118What's the issue
When landing the theme.json support in core, we're going to change the settings format passed down to the editor: some things will be removed because they're substituted by new fine-grained settings provided by theme.json.
For example, if a theme opts-in into the
editor-color-palette
, that becomes thecolors
setting in the editor at the moment. However, this is absorbed by theme.json in which themes can create different color palettes by block ― hence thecolors
settings are no longer passed down to the editor.Right now, we do:
block_editor_settings
filter for 3rd parties to hook into.The issue with this is that we don't allow 3rd parties to filter the theme.json settings #27504 A second issue is that if we want to change the settings format we're breaking backward-compatibility with 3rd party plugins.
The text was updated successfully, but these errors were encountered: