-
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
Updates WP_Theme_JSON_Resolver
and tests to be equal to core
#36223
Conversation
Size Change: 0 B Total Size: 1.09 MB ℹ️ View Unchanged
|
* | ||
* @return string|string[]|array[] Translated settings. | ||
*/ | ||
function gutenberg_translate_settings_using_i18n_schema( $i18n_schema, $settings, $textdomain ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions are already part of the core. Are they part of 5.8 if yes we can just remove the Gutenberg versions and use core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I saw, they were introduced in August, post-5.8 release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well on my tests and seems to match what is already in core.
gutenberg_experimental_set( $theme_json, $path, $translated_array ); | ||
} | ||
if ( null === self::$i18n_schema ) { | ||
$i18n_schema = wp_json_file_decode( __DIR__ . '/theme-i18n.json' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be gutenberg_json_file_decode
, or we should rename the function. It is causing a fatal error, and I'm not able to access the site editor.
} | ||
|
||
return $theme_json; | ||
return translate_settings_using_i18n_schema( self::$i18n_schema, $theme_json, $domain ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line as well.
PHP Fatal error: Uncaught Error: Call to undefined function wp_json_file_decode() in gutenberg/wp-content/plugins/gutenberg/lib/class-wp-theme-json-resolver-gutenberg.php:101
Related WordPress/wordpress-develop#1808
This PR adapts the Gutenberg code to be like WordPress core, so it's easier to identify changes. In this commit, we made changes to the class in WordPress core that weren't ported to Gutenberg.
How to test
Verify tests pass.