Expose a higher API to interact with Global Styles#29905
Closed
Expose a higher API to interact with Global Styles#29905
Conversation
|
Size Change: 0 B Total Size: 1.4 MB ℹ️ View Unchanged
|
Member
Author
|
After landing #30541 this has a lot of conflicts. It's best if we prepare a separate PR that takes into account all we've learned. |
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.
Inspired by and alternative to #29667
This PR creates a higher API for the existing
WP_Theme_JSON_Resolver. Previously it exposed lower-level primitives to interact with the different origins of data (core, theme, user). By exposing a higher-level API the data input and the code paths supported by this API are clearer.WP_Theme_JSON_Resolver::theme_has_support()WP_Theme_JSON_Resolver::theme_has_support()WP_Theme_JSON_Resolver::get_theme_data()->get_template_parts()WP_Theme_JSON_Resolver::get_template_parts()WP_Theme_JSON_Resolver::get_theme_data()->get_custom_templates()WP_Theme_JSON_Resolver::get_custom_templates()initWP_Theme_JSON_Resolver::register_user_custom_post_type()WP_Theme_JSON_Resolver::register_user_custom_post_type();block_editor_settingsWP_Theme_JSON_Resolver::get_user_custom_post_type_id();WP_Theme_JSON_Resolver::get_user_custom_post_type_id();block_editor_settings$origin = some_code_for_origin_calculation();$tree = WP_Theme_JSON_Resolver::get_merged_data( $theme_support_data, $origin );$tree->get_settings();WP_Theme_JSON_Resolver::get_settings( $theme_support_data );wp_enqueue_scripts$all = WP_Theme_JSON_Resolver::get_merged_data( $theme_support_data );$stylesheet = gutenberg_experimental_global_styles_get_stylesheet( $all );WP_Theme_JSON_Resolver::get_stylesheet( $theme_support_data );block_editor_settings$origin = some_code_for_origin_calculation();$tree = WP_Theme_JSON_Resolver::get_merged_data( $theme_support_data, $origin );$css_vars = gutenberg_experimental_global_styles_get_stylesheet( $tree, 'css_variables' );$block_styles = gutenberg_experimental_global_styles_get_stylesheet( $tree, 'block_styles' );$css_vars = WP_Theme_Config_Resolver::get_stylesheet( $theme_support_data, 'css_variables' );$block_styles = WP_Theme_Config_Resolver::get_stylesheet( $theme_support_data, 'block_styles' );block_editor_settingsWP_Theme_JSON_Resolver::get_merged_data( $theme_support_data, 'theme' )->get_raw_data();WP_Theme_Config_Resolver::get_theme_styles_and_settings( $theme_support_data );How to test
npm run test-unit-php).