WP_Theme_JSON::convert_variables_to_value( array $styles, array $values ): array

In this article

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.

Replaces CSS variables with their values in place.

Parameters

$stylesarrayrequired
CSS declarations to convert.
$valuesarrayrequired
key => value pairs to use for replacement.

Return

array

Source

}

/**
 * Returns a valid theme.json as provided by a theme.
 *
 * Unlike get_raw_data() this returns the presets flattened, as provided by a theme.
 * This also uses appearanceTools instead of their opt-ins if all of them are true.
 *
 * @since 6.0.0
 *
 * @return array
 */
public function get_data() {
	$output = $this->theme_json;
	$nodes  = static::get_setting_nodes( $output );

	/**
	 * Flatten the theme & custom origins into a single one.
	 *
	 * For example, the following:
	 *
	 * {
	 *   "settings": {
	 *     "color": {
	 *       "palette": {
	 *         "theme": [ {} ],
	 *         "custom": [ {} ]
	 *       }
	 *     }
	 *   }
	 * }
	 *
	 * will be converted to:
	 *
	 * {
	 *   "settings": {
	 *     "color": {

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

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