WP_Theme_JSON::update_separator_declarations( array $declarations ): 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.

Returns a filtered declarations array if there is a separator block with only a background style defined in theme.json by adding a color attribute to reflect the changes in the front.

Parameters

$declarationsarrayrequired
List of declarations.

Return

array $declarations List of declarations filtered.

Source

 *       'value' => 'property_value,
 *     )
 *
 * @since 5.8.0
 *
 * @param array $settings Settings to process.
 * @return array The modified $declarations.
 */
protected static function compute_theme_vars( $settings ) {
	$declarations  = array();
	$custom_values = isset( $settings['custom'] ) ? $settings['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;
}

/**
 * Given a tree, it creates a flattened one
 * by merging the keys and binding the leaf values
 * to the new keys.
 *
 * It also transforms camelCase names into kebab-case

Changelog

VersionDescription
6.1.1Introduced.

User Contributed Notes

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