WordPress at Your Fingertips
function is not described

WP_Theme_JSON::to_ruleset() private WP 5.8.0

Given a selector and a declaration list, creates the corresponding ruleset.

{} It's a method of the class: WP_Theme_JSON{}

No Hooks.

Return

String. CSS ruleset.

Usage

$result = WP_Theme_JSON::to_ruleset( $selector, $declarations );
$selector(string) (required)
CSS selector.
$declarations(array) (required)
List of declarations.

Changelog

Since 5.8.0 Introduced.

Code of WP_Theme_JSON::to_ruleset() WP 5.8.2

private static function to_ruleset( $selector, $declarations ) {
	if ( empty( $declarations ) ) {
		return '';
	}

	$declaration_block = array_reduce(
		$declarations,
		function ( $carry, $element ) {
			return $carry .= $element['name'] . ': ' . $element['value'] . ';'; },
		''
	);

	return $selector . '{' . $declaration_block . '}';
}