WP_Theme_JSON::resolve_custom_css_formatprivate staticWP 6.3.0

Given a tree, converts the internal representation of variables to the CSS representation. It is recursive and modifies the input in-place.

Метод класса: WP_Theme_JSON{}

Хуков нет.

Возвращает

Массив. The modified $tree.

Использование

$result = WP_Theme_JSON::resolve_custom_css_format( $tree );
$tree(массив) (обязательный)
Input to process.

Список изменений

С версии 6.3.0 Введена.

Код WP_Theme_JSON::resolve_custom_css_format() WP 7.0

private static function resolve_custom_css_format( $tree ) {
	$prefix = 'var:';

	foreach ( $tree as $key => $data ) {
		if ( is_string( $data ) && str_starts_with( $data, $prefix ) ) {
			$tree[ $key ] = self::convert_custom_properties( $data );
		} elseif ( is_array( $data ) ) {
			$tree[ $key ] = self::resolve_custom_css_format( $data );
		}
	}

	return $tree;
}