Changeset 55986 for trunk/src/wp-includes/global-styles-and-settings.php
- Timestamp:
- 06/22/2023 08:42:42 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/global-styles-and-settings.php
r55983 r55986 93 93 * 94 94 * @since 5.9.0 95 * @since 6.3.0 the internal format "var:preset|color|secondary" is always resolved 96 * to the standard form "var(--wp--preset--font-size--small)". 95 * @since 6.3.0 the internal link format "var:preset|color|secondary" is resolved 96 * to "var(--wp--preset--font-size--small)" so consumers don't have to. 97 * @since 6.3.0 `transforms` is now usable in the `context` parameter. In case [`transforms`]['resolve_variables'] 98 * is defined, variables are resolved to their value in the styles. 97 99 * 98 100 * @param array $path Path to the specific style to retrieve. Optional. … … 106 108 * Valid values are 'all' (core, theme, and user) or 'base' (core and theme). 107 109 * If empty or unknown, 'all' is used. 110 * @type array $transforms Which transformation(s) to apply. 111 * Valid value is array( 'resolve-variables' ). 112 * If defined, variables are resolved to their value in the styles. 108 113 * } 109 114 * @return mixed The styles array or individual style value to retrieve. … … 118 123 $origin = 'theme'; 119 124 } 120 $styles = WP_Theme_JSON_Resolver::get_merged_data( $origin )->get_raw_data()['styles']; 121 125 126 $resolve_variables = isset( $context['transforms'] ) 127 && is_array( $context['transforms'] ) 128 && in_array( 'resolve-variables', $context['transforms'], true ); 129 130 $merged_data = WP_Theme_JSON_Resolver::get_merged_data( $origin ); 131 if ( $resolve_variables ) { 132 $merged_data = WP_Theme_JSON::resolve_variables( $merged_data ); 133 } 134 $styles = $merged_data->get_raw_data()['styles']; 122 135 return _wp_array_get( $styles, $path, $styles ); 123 136 } 137 124 138 125 139 /**
Note: See TracChangeset
for help on using the changeset viewer.