You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ascertain whether it's possible to hook into and override theme.json settings in a particular editor context (e.g. can we override certain settings within the Nav Editor
Please see the link above for why we might we want to do this.
Currently the global styles settings are derived from x3 sources
This would allow the Nav Editor to filter the settings.
Considerations
Is it a good idea to allow developers to potentially override User settings (recall User is one of the x3 sources for Global Styles settings)?
We could consider only allow overriding of Core/Theme settings. That would leave users fully "in charge" but (hopefully) still allow us to filter the settings in the Nav Editor. If the Nav block was configured via Theme JSON then this would allow us to alter the behaviour/display of the Nav block whilst used in the Nav Editor.
The text was updated successfully, but these errors were encountered:
getdave
changed the title
Ascertain whether it's possible to hook into and override theme.json settings in a particular editor context (e.g. can we override certain settings within the Nav Editor
Ascertain whether it's possible to hook into and override theme.json settings in a particular editor context
Sep 13, 2021
Here's another reason one might want to hook in and override theme.json settings. I'm hosting a multi-site installation. In that installation, I offer a custom but highly configurable theme. Different sites using the same theme are configured differently. I would want my theme to have a chance to make some of those theme.json-configured decisions differently for different sites, depending on their dynamic configuration. In my case, the different editor contexts would be different subsites using the same installation of the same theme, but with different site-specific configurations.
For example, different sites may have different blocks available, or have certain capabilities of certain blocks enabled or disabled depending on the site-specific configuration.
I have been searching for how to make that happen, and this issue suggests to me that it's not (yet) possible. I do like the proposed idea for a filter that would allow the theme to have one last chance to update the merged configuration before the block editor responds to it.
If there's another way for the theme programming to make some of the theme.json decisions dynamically, I'd welcome that guidance as well.
You are right. I explored this and it's not possible...yet. I'm no longer actively pursuing this route but it's possible it might be something that is considered in future.
Part of #30007 (comment)
Please see the link above for why we might we want to do this.
Currently the global styles settings are derived from x3 sources
theme.json
)There is a resolver which collates these disparate sources and merges them to form the final global styles settings.
Currently there is - by design or otherwise - no way to filter these settings.
Potential Solution
We could consider proposing a filter here:
gutenberg/lib/class-wp-theme-json-resolver-gutenberg.php
Line 427 in de446ff
It might look like this:
+ $result = apply_filters( 'theme_json_resolver_merged_data', $result ); return $result;
This would allow the Nav Editor to filter the settings.
Considerations
Is it a good idea to allow developers to potentially override User settings (recall User is one of the x3 sources for Global Styles settings)?
We could consider only allow overriding of Core/Theme settings. That would leave users fully "in charge" but (hopefully) still allow us to filter the settings in the Nav Editor. If the Nav block was configured via Theme JSON then this would allow us to alter the behaviour/display of the Nav block whilst used in the Nav Editor.
The text was updated successfully, but these errors were encountered: