WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Theme_JSON::get_block_styles() private WP 5.8.0

Converts each style section into a list of rulesets containing the block styles to be appended to the stylesheet.

See glossary at https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax

For each section this creates a new ruleset such as:

block-selector {

style-property-one: value;

}

Additionally, it'll also create new rulesets as classes for each preset value such as:

.has-value-color {
  color: value;
}
.has-value-background-color {
  background-color: value;
}
.has-value-font-size {
  font-size: value;
}
.has-value-gradient-background {
  background: value;
}
p.has-value-gradient-background {
  background: value;
}

{} Это метод класса: WP_Theme_JSON{}

Хуков нет.

Возвращает

Строку. The new stylesheet.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_block_styles( $style_nodes, $setting_nodes );
$style_nodes(массив) (обязательный)
Nodes with styles.
$setting_nodes(массив) (обязательный)
Nodes with settings.

Список изменений

С версии 5.8.0 Введена.

Код WP_Theme_JSON::get_block_styles() WP 5.8.1

private function get_block_styles( $style_nodes, $setting_nodes ) {
	$block_rules = '';
	foreach ( $style_nodes as $metadata ) {
		if ( null === $metadata['selector'] ) {
			continue;
		}

		$node         = _wp_array_get( $this->theme_json, $metadata['path'], array() );
		$selector     = $metadata['selector'];
		$declarations = self::compute_style_properties( $node );
		$block_rules .= self::to_ruleset( $selector, $declarations );
	}

	$preset_rules = '';
	foreach ( $setting_nodes as $metadata ) {
		if ( null === $metadata['selector'] ) {
			continue;
		}

		$selector      = $metadata['selector'];
		$node          = _wp_array_get( $this->theme_json, $metadata['path'], array() );
		$preset_rules .= self::compute_preset_classes( $node, $selector );
	}

	return $block_rules . $preset_rules;
}