WP_Theme_JSON_Resolver::resolve_theme_file_urispublic staticWP 6.6.0

Resolves relative paths in theme.json styles to theme absolute paths and merges them with incoming theme JSON.

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

Хуков нет.

Возвращает

WP_Theme_JSON. Theme merged with resolved paths, if any found.

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

$result = WP_Theme_JSON_Resolver::resolve_theme_file_uris( $theme_json );
$theme_json(WP_Theme_JSON) (обязательный)
A theme json instance.

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

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

Код WP_Theme_JSON_Resolver::resolve_theme_file_uris() WP 6.9

public static function resolve_theme_file_uris( $theme_json ) {
	$resolved_urls = static::get_resolved_theme_uris( $theme_json );
	if ( empty( $resolved_urls ) ) {
		return $theme_json;
	}

	$resolved_theme_json_data = $theme_json->get_raw_data();

	foreach ( $resolved_urls as $resolved_url ) {
		$path = explode( '.', $resolved_url['target'] );
		_wp_array_set( $resolved_theme_json_data, $path, $resolved_url['href'] );
	}

	return new WP_Theme_JSON( $resolved_theme_json_data );
}