WP_Theme_JSON::compute_theme_vars()
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,
)
Метод класса: WP_Theme_JSON{}
Хуков нет.
Возвращает
Массив
. The modified $declarations.
Использование
$result = WP_Theme_JSON::compute_theme_vars( $settings );
- $settings(массив) (обязательный)
- Settings to process.
Список изменений
С версии 5.8.0 | Введена. |
Код WP_Theme_JSON::compute_theme_vars() WP Theme JSON::compute theme vars WP 6.2.2
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; }