Skip to content

Commit

Permalink
Rollback test of imperative method in resolver
Browse files Browse the repository at this point in the history
Rollback test of imperative method in resolver
  • Loading branch information
ramonjd committed May 1, 2024
1 parent 7ad02c7 commit 5edf884
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
30 changes: 0 additions & 30 deletions lib/class-wp-theme-json-resolver-gutenberg.php
Expand Up @@ -762,34 +762,4 @@ public static function get_style_variations() {
}
return $variations;
}

/**
* Resolves relative paths in theme.json styles to theme absolute paths.
*
* @since 6.6.0
*
* @param WP_Theme_JSON_Gutenberg $theme_json A theme json instance.
* @return WP_Theme_JSON_Gutenberg A theme json instance with resolved paths.
*/
protected static function resolve_theme_file_uris( $theme_json ) {
if ( empty( $theme_json ) ) {
return;
}

/*
* Styles backgrounds.
* Where a URL is not absolute (has no host fragment), it is assumed to be relative to the theme directory.
* Blocks, elements, and block variations are not yet supported.
*/
if (
isset( $theme_json['styles']['background']['backgroundImage']['url'] ) &&
is_string( $theme_json['styles']['background']['backgroundImage']['url'] ) &&
! isset( wp_parse_url( $theme_json['styles']['background']['backgroundImage']['url'] )['host'] ) ) {
_wp_array_set(
$theme_json,
array( 'styles', 'background', 'backgroundImage', 'url' ),
esc_url( get_theme_file_uri( $theme_json['styles']['background']['backgroundImage']['url'] ) )
);
}
}
}
2 changes: 1 addition & 1 deletion lib/global-styles-and-settings.php
Expand Up @@ -27,7 +27,7 @@ function gutenberg_get_global_stylesheet( $types = array() ) {
return $cached;
}
}
$tree = WP_Theme_JSON_Resolver_Gutenberg::get_merged_data()->resolve_theme_file_uris();
$tree = WP_Theme_JSON_Resolver_Gutenberg::get_merged_data();

$supports_theme_json = wp_theme_has_theme_json();
if ( empty( $types ) && ! $supports_theme_json ) {
Expand Down

0 comments on commit 5edf884

Please sign in to comment.