WP_Theme_JSON::to_ruleset()
Given a selector and a declaration list, creates the corresponding ruleset.
Метод класса: WP_Theme_JSON{}
Хуков нет.
Возвращает
Строку
. The resulting CSS ruleset.
Использование
$result = WP_Theme_JSON::to_ruleset( $selector, $declarations );
- $selector(строка) (обязательный)
- CSS selector.
- $declarations(массив) (обязательный)
- List of declarations.
Список изменений
С версии 5.8.0 | Введена. |
Код WP_Theme_JSON::to_ruleset() WP Theme JSON::to ruleset WP 6.1.1
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 . '}'; }