Changeset 52675
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/global-styles-and-settings.php
r52275 r52675 104 104 } 105 105 106 $tree = WP_Theme_JSON_Resolver::get_merged_data(); 107 106 108 $supports_theme_json = WP_Theme_JSON_Resolver::theme_has_support(); 107 $supports_link_color = get_theme_support( 'experimental-link-color' );108 109 if ( empty( $types ) && ! $supports_theme_json ) { 109 110 $types = array( 'variables', 'presets' ); … … 112 113 } 113 114 114 $origins = array( 'default', 'theme', 'custom' ); 115 if ( ! $supports_theme_json && ! $supports_link_color ) { 116 // In this case we only enqueue the core presets (CSS Custom Properties + the classes). 117 $origins = array( 'default' ); 118 } elseif ( ! $supports_theme_json && $supports_link_color ) { 119 // For the legacy link color feature to work, the CSS Custom Properties 120 // should be in scope (either the core or the theme ones). 121 $origins = array( 'default', 'theme' ); 115 // If variables are part of the stylesheet, 116 // we add them for all origins (default, theme, user). 117 // This is so themes without a theme.json still work as before 5.9: 118 // they can override the default presets. 119 // See https://core.trac.wordpress.org/ticket/54782 120 $styles_variables = ''; 121 if ( in_array( 'variables', $types ) ) { 122 $styles_variables = $tree->get_stylesheet( array( 'variables' ) ); 123 $types = array_diff( $types, array( 'variables' ) ); 122 124 } 123 125 124 $tree = WP_Theme_JSON_Resolver::get_merged_data(); 125 $stylesheet = $tree->get_stylesheet( $types, $origins ); 126 // For the remaining types (presets, styles), we do consider origins: 127 // 128 // - themes without theme.json: only the classes for the presets defined by core 129 // - themes with theme.json: the presets and styles classes, both from core and the theme 130 $styles_rest = ''; 131 if ( ! empty( $types ) ) { 132 $origins = array( 'default', 'theme', 'custom' ); 133 if ( ! $supports_theme_json ) { 134 $origins = array( 'default' ); 135 } 136 $styles_rest = $tree->get_stylesheet( $types, $origins ); 137 } 138 139 $stylesheet = $styles_variables . $styles_rest; 126 140 127 141 if ( $can_use_cached ) {
Note: See TracChangeset
for help on using the changeset viewer.