Given a selector and a declaration list, creates the corresponding ruleset.
Parameters
$selectorstringrequired- CSS selector.
$declarationsarrayrequired- List of declarations.
Source
protected static function to_ruleset( $selector, $declarations ) {
if ( empty( $declarations ) ) {
return '';
}
$declaration_block = array_reduce(
$declarations,
static function ( $carry, $element ) {
return $carry .= $element['name'] . ': ' . $element['value'] . ';'; },
''
);
return $selector . '{' . $declaration_block . '}';
}
Changelog
| Version | Description |
|---|---|
| 5.8.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.