-
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
wp_get_global_styles
: resolver the reference to the value
#49715
Comments
wp_get_global_styles
: whether to return the reference or the valuewp_get_global_styles
: resolver the reference to the value
Note that by not resolving the references we are pushing complexity to the consumers:
|
Would something like this work? #49737 |
I've done some digging to find out the places where references are exposed to the consumers. There are a few, and I'm afraid that consumers need to deal with this complexity already:
I wonder if Ideas about next steps:
Is that all the options we have? If so, I'm inclined to go with 1 because 2 doesn't solve the use case of the Thoughts? |
Thanks for doing the heavy thinking around this @oandregal
I think this sounds like a good approach - more testable and easier to drop in to places where folks need it. Just curious: do you see I'm not 100% over the issue, but I'd also assume we'd use it within wp_get_global_styles, e.g.,
What do you think? |
It sounds good to create I'm not sure what to do about
The reason I am undecided is that the WordPress code itself doesn't use the |
I'll cc @BogdanUngureanu on this, who is more familiar with this than me (related). |
If we change for example, what it is returned from If it's an enhancement to |
Thanks for the ping, @oandregal. I'm not sure if that's what you are looking for, but in case it's helpful:
|
I'm personally more inclined towards providing a utility function, as explained in the 3rd option , the reasoning behind it:
@oandregal what do you think? |
Relevant thread for this conversation, so we can see everything together https://github.com/WordPress/gutenberg/pull/50484/files#r1192502874 |
Related #45171
Description
When using references, the
wp_get_global_styles
functions returns the internal reference link instead of the CSS value.Step-by-step reproduction instructions
theme.json
.styles.blocks
:wp_get_global_styles
functions to retrieve those styles. For example, paste the following infunctions.php
of the theme:The result will be:
Instead, the expected value is that the reference should be resolved to the actual CSS value. Let's say the root background color is
black
, so the result should be:( [color] => Array( [background] => black ) )
Otherwise, the consumers of this function need to wrangle this themselves, as in #49693
The text was updated successfully, but these errors were encountered: