Skip to content

Commit

Permalink
Rollback test of imperative method in resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed May 1, 2024
1 parent 7ad02c7 commit 8840474
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions lib/class-wp-theme-json-resolver-gutenberg.php
Original file line number Diff line number Diff line change
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'] ) )
);
}
}
}

0 comments on commit 8840474

Please sign in to comment.