WP_Theme_JSON::compute_theme_vars() – Given an array of settings, it extracts the CSS Custom Properties for the custom values and adds them to the $declarations array following the format:
You appear to be a bot. Output may be restricted
Description
Given an array of settings, extracts the CSS Custom Properties for the custom values and adds them to the $declarations array following the format:
array(
- 'name' => 'property_name',
- 'value' => 'property_value,
- )
Usage
$array = WP_Theme_JSON::compute_theme_vars( $settings );
Parameters
- $settings
- ( array ) required – Settings to process.
Returns
array The modified $declarations.
Source
File name: wordpress/wp-includes/class-wp-theme-json.php
Lines:
1 to 13 of 13
protected static function compute_theme_vars( $settings ) { $declarations = array(); $custom_values = _wp_array_get( $settings, array( 'custom' ), array() ); $css_vars = static::flatten_tree( $custom_values ); foreach ( $css_vars as $key => $value ) { $declarations[] = array( 'name' => '--wp--custom--' . $key, 'value' => $value, ); } return $declarations; }