-
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
Add extensibility hooks to global styles infrastructure #27504
Comments
cc @aristath you had a PR for this that I'm failing to find. Would you like to share the use cases you wanted to address? |
The PR I had was in #25499 but I closed it 'cause I'll have to do it again taking into account all recent structural changes. Examples for plugins that will need to use these filters:
In order for plugins to be able to properly modify the "presets" for theme-styles, they'll need to be able to hook there, modify the JSON and inject their own css-vars in the final CSS. |
No rush to make a PR, we may need more changes. I just want to have a place to create clarity about the use cases we need to support. For example, the two things you mentioned seem to me that are related to the UI, is that correct? It so, I don't think we can't do anything here, this is only for the infrastructure pieces we plan to land in #27506 UI-hooks can be discussed separately, as we'd have to iterate on the UI first #27473 |
In a conversation with @jorgefilipecosta he mentioned an idea that I wanted to document: what if instead of introducing multiple hooks for different steps of the lifecycle we allow to have a single hook to replace the whole implementation entirely? He mentioned we do this for core blocks (see). From the Gutenberg plugin perspective, it sounds like it could be more useful in this initial stage. I don't think it'd be that useful for themes/plugins that want to extend how this works but I'm also unsure what are the use cases for these that can't be done with the current settings filter. |
Going to close this one as per WordPress/wordpress-develop#1262 and WordPress/wordpress-develop#1287 For WordPress 5.8 we haven't introduced specific filters for global styles but instead, we rely on the existing WordPress mechanisms. |
@nosolosw Can you explain what the "existing infrastructure" is how and how it will enable plugins to modify global styles which is the purpose of this ticket? A quick look through the two links didn't provide any obvious answers for me on that need. |
@mrwweb there are a few things:
As you can notice, these aren't "global styles" specific hooks but we rely on the existing mechanisms of WordPress and the block editor. As things mature, we should consider specific ones. I closed this issue because it no longer served the original purpose, which was to figure out what we needed for the first iteration. I presume we've have to create a next iteration for the "global styles" focus at #20331 or an entirely new issue, including API stabilization and polishing. |
@oandregal Readying through all this I can see how extenders can hook into the global styles system to add custom logic to allow new properties and generate the styles output. However, the piece that is missing from what I can tell is the ability to render custom controls in the global styles interface so that these settings can be configured. Is there something I'm missing or is that the state of things? :) I opened #47990 to flag this but want to make sure I'm not missing anything. |
Related #27506
As the different pieces of "Global Styles" land into WordPress core, we need the ability to extend a few things:
The ability to modify the schema: add/remove style properties & block supports, settings, and, generally, new versions of the schema. See how
PROPERTIES_METADATA
andSCHEMA
are used inWP_Theme_JSON
. Related Handle an evolving theme.json shape (consider add versioning). #27230The ability to config things differently: allow third-parties to enable/disable settings, new values for styles, etc. For this one, is it enough with what we have (block_editor_settings filter)? or would it be benefitial to hook into
WP_Theme_JSON->get_settings
,WP_Theme_JSON->get_stylesheet
,WP_Theme_JSON->get_raw_data
to modify the tree before those methods do their thing?The ability to hook into how trees are merged. See
WP_Theme_JSON::merge
The text was updated successfully, but these errors were encountered: