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

foreach ( $declarations as $declaration ) {
	if ( static::is_safe_css_declaration( $declaration['name'], $declaration['value'] ) ) {
		$path = static::PROPERTIES_METADATA[ $declaration['name'] ];

		/*
		 * Check the value isn't an array before adding so as to not
		 * double up shorthand and longhand styles.
		 */
		$value = _wp_array_get( $input, $path, array() );
		if ( ! is_array( $value ) ) {
			_wp_array_set( $output, $path, $value );
		}
	}
}

// Ensure indirect properties not handled by `compute_style_properties` are allowed.
static::remove_indirect_properties( $input, $output );

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

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