Changeset 52678 for branches/5.9
- Timestamp:
- 02/04/2022 02:46:27 PM (3 years ago)
- Location:
- branches/5.9
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/5.9
- Property svn:mergeinfo changed
/trunk merged: 52675-52677
- Property svn:mergeinfo changed
-
branches/5.9/src/wp-includes/global-styles-and-settings.php
r52275 r52678 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 /* 116 * If variables are part of the stylesheet, 117 * we add them for all origins (default, theme, user). 118 * This is so themes without a theme.json still work as before 5.9: 119 * they can override the default presets. 120 * See https://core.trac.wordpress.org/ticket/54782 121 */ 122 $styles_variables = ''; 123 if ( in_array( 'variables', $types, true ) ) { 124 $styles_variables = $tree->get_stylesheet( array( 'variables' ) ); 125 $types = array_diff( $types, array( 'variables' ) ); 122 126 } 123 127 124 $tree = WP_Theme_JSON_Resolver::get_merged_data(); 125 $stylesheet = $tree->get_stylesheet( $types, $origins ); 128 /* 129 * For the remaining types (presets, styles), we do consider origins: 130 * 131 * - themes without theme.json: only the classes for the presets defined by core 132 * - themes with theme.json: the presets and styles classes, both from core and the theme 133 */ 134 $styles_rest = ''; 135 if ( ! empty( $types ) ) { 136 $origins = array( 'default', 'theme', 'custom' ); 137 if ( ! $supports_theme_json ) { 138 $origins = array( 'default' ); 139 } 140 $styles_rest = $tree->get_stylesheet( $types, $origins ); 141 } 142 143 $stylesheet = $styles_variables . $styles_rest; 126 144 127 145 if ( $can_use_cached ) {
Note: See TracChangeset
for help on using the changeset viewer.