Make WordPress Core


Ignore:
Timestamp:
05/31/2024 01:17:50 AM (9 months ago)
Author:
noisysocks
Message:

Block Themes: Add support for relative URLs in top-level theme.json styles

Allow using relative file: URLs in top-level theme.json properties such as
styles.background, and modify the REST API to provide clients with the
absolute URLs via a 'https://api.w.org/theme-file' attribute in the _links
array.

Props ramonopoly.
Fixes #61273.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/global-styles-and-settings.php

    r58026 r58262  
    140140 * @since 5.9.0
    141141 * @since 6.1.0 Added 'base-layout-styles' support.
     142 * @since 6.6.0 Resolves relative paths in theme.json styles to theme absolute paths.
    142143 *
    143144 * @param array $types Optional. Types of styles to load.
     
    180181    }
    181182
    182     $tree = WP_Theme_JSON_Resolver::get_merged_data();
    183 
     183    $tree                = WP_Theme_JSON_Resolver::resolve_theme_file_uris( WP_Theme_JSON_Resolver::get_merged_data() );
    184184    $supports_theme_json = wp_theme_has_theme_json();
     185
    185186    if ( empty( $types ) && ! $supports_theme_json ) {
    186187        $types = array( 'variables', 'presets', 'base-layout-styles' );
Note: See TracChangeset for help on using the changeset viewer.