Conversation
4ffbe2f to
acd2881
Compare
| $is_global_styles_user_theme_json = isset( $config['isGlobalStylesUserThemeJSON'] ) && true === $config['isGlobalStylesUserThemeJSON']; | ||
| $raw_config = json_decode( $post->post_content, true ); | ||
| $is_global_styles_user_theme_json = isset( $raw_config['isGlobalStylesUserThemeJSON'] ) && true === $raw_config['isGlobalStylesUserThemeJSON']; | ||
| $config; |
Member
There was a problem hiding this comment.
Is this supposed to be set to something?
Member
Author
There was a problem hiding this comment.
No, it is not I'm just instantiating the variable because it is used outside the if condition where we set the variable.
Member
|
Feels like this would be a good candidate for wrapping up into a standalone function? |
oandregal
approved these changes
Nov 23, 2021
Member
oandregal
left a comment
There was a problem hiding this comment.
This fixes the issue I ran to as well. We need this fix asap to continue iterating on the GS code so I'm approving this.
I agree some of this code could be improved to be packed in utility functions. We can probably use the WP_Theme_JSON_Resolver::get_user_data and similar functions. Can be done in a follow-up PR to unblock related work.
Member
|
Related #36584 |
noisysocks
pushed a commit
that referenced
this pull request
Nov 29, 2021
…#36747) * Update: Automatically migrate global styles user database data on the rest endpoint. * Fix lint issues Co-authored-by: André <583546+oandregal@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After merging #36674, I noticed although we were back-compatible on the frontend we were not being back-compatible on the site editor because our migration logic was not being called on the rest endpoint. This PR fixes the issue and makes sure that the data returned by the endpoint passes by the WP_Theme_JSON_Gutenberg constructor which includes migration and back-compatibility logic.
How has this been tested?
I made the global styles CPT equal to:
To force global styles CPT to have the previous value I changed show_ui to true in lib/class-wp-theme-json-resolver-gutenberg.php and opened the CPT on the editor and pasted the data. Changing the post using phpmyadmin or a similar tool is also ok.
I opened the site editor and verified everything looks as excepted and the palette provided is assumed to be the user one.