WP_Theme_JSON::resolve_variables( WP_Theme_JSON $theme_json ): WP_Theme_JSON

In this article

Resolves the values of CSS variables in the given styles.

Parameters

$theme_jsonWP_Theme_JSONrequired
The theme json resolver.

Return

WP_Theme_JSON The $theme_json with resolved variables.

Source

				$fallback        = $var_parts[2][ $index ]; // the fallback value.
				$resolved_style  = str_replace(
					array(
						$rule_to_replace,
						$fallback,
					),
					array(
						isset( $values[ $key_in_values ] ) ? $values[ $key_in_values ] : $rule_to_replace,
						isset( $values[ $fallback ] ) ? $values[ $fallback ] : $fallback,
					),
					$resolved_style
				);
			}
			$styles[ $key ] = $resolved_style;
		}
	}
}

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.