Resolves relative paths in theme.json styles to theme absolute paths and merges them with incoming theme JSON.
Parameters
$theme_json
WP_Theme_JSONrequired- A theme json instance.
Source
public static function resolve_theme_file_uris( $theme_json ) {
$resolved_urls = static::get_resolved_theme_uris( $theme_json );
if ( empty( $resolved_urls ) ) {
return $theme_json;
}
$resolved_theme_json_data = array(
'version' => WP_Theme_JSON::LATEST_SCHEMA,
);
foreach ( $resolved_urls as $resolved_url ) {
$path = explode( '.', $resolved_url['target'] );
_wp_array_set( $resolved_theme_json_data, $path, $resolved_url['href'] );
}
$theme_json->merge( new WP_Theme_JSON( $resolved_theme_json_data ) );
return $theme_json;
}
Changelog
Version | Description |
---|---|
6.6.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.