WP_Theme_JSON::compute_theme_vars( array $settings ): array

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

Description

array( ‘name’ => ‘property_name’, ‘value’ => ‘property_value, )

Parameters

$settingsarrayrequired
Settings to process.

Return

array The modified $declarations.

Source

protected static function compute_preset_vars( $settings, $origins ) {
	$declarations = array();
	foreach ( static::PRESETS_METADATA as $preset_metadata ) {
		if ( empty( $preset_metadata['css_vars'] ) ) {
			continue;
		}
		$values_by_slug = static::get_settings_values_by_slug( $settings, $preset_metadata, $origins );
		foreach ( $values_by_slug as $slug => $value ) {
			$declarations[] = array(
				'name'  => static::replace_slug_in_string( $preset_metadata['css_vars'], $slug ),
				'value' => $value,
			);
		}

Changelog

VersionDescription
5.8.0Introduced.

User Contributed Notes

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