WordPress at Your Fingertips
function is not described

WP_Theme_JSON::compute_theme_vars() private WP 5.8.0

Given an array of settings, it extracts the CSS Custom Properties for the custom values and adds them to the $declarations array following the format:

array( 'name' => 'property_name', 'value' => 'property_value,

)

{} It's a method of the class: WP_Theme_JSON{}

No Hooks.

Return

Array. Returns the modified $declarations.

Usage

$result = WP_Theme_JSON::compute_theme_vars( $settings );
$settings(array) (required)
Settings to process.

Changelog

Since 5.8.0 Introduced.

Code of WP_Theme_JSON::compute_theme_vars() WP 5.8.2

private static function compute_theme_vars( $settings ) {
	$declarations  = array();
	$custom_values = _wp_array_get( $settings, array( 'custom' ), array() );
	$css_vars      = self::flatten_tree( $custom_values );
	foreach ( $css_vars as $key => $value ) {
		$declarations[] = array(
			'name'  => '--wp--custom--' . $key,
			'value' => $value,
		);
	}

	return $declarations;
}