WP_Theme_JSON::resolve_custom_css_format( array $tree ): array

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Given a tree, converts the internal representation of variables to the CSS representation.

Description

It is recursive and modifies the input in-place.

Parameters

$treearrayrequired
Input to process.

Return

array The modified $tree.

Source

 * @return string The converted variable.
 */
private static function convert_custom_properties( $value ) {
	$prefix     = 'var:';
	$prefix_len = strlen( $prefix );
	$token_in   = '|';
	$token_out  = '--';
	if ( str_starts_with( $value, $prefix ) ) {
		$unwrapped_name = str_replace(
			$token_in,
			$token_out,
			substr( $value, $prefix_len )
		);

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

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