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

WP_Theme_JSON::compute_preset_classes() private WP 5.8.0

Given a settings array, it returns the generated rulesets for the preset classes.

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

Хуков нет.

Возвращает

Строку. The result of processing the presets.

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

$result = WP_Theme_JSON::compute_preset_classes( $settings, $selector );
$settings(массив) (обязательный)
Settings to process.
$selector(строка) (обязательный)
Selector wrapping the classes.

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

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

Код WP_Theme_JSON::compute_preset_classes() WP 5.8.1

private static function compute_preset_classes( $settings, $selector ) {
	if ( self::ROOT_BLOCK_SELECTOR === $selector ) {
		// Classes at the global level do not need any CSS prefixed,
		// and we don't want to increase its specificity.
		$selector = '';
	}

	$stylesheet = '';
	foreach ( self::PRESETS_METADATA as $preset ) {
		$preset_per_origin = _wp_array_get( $settings, $preset['path'], array() );
		$preset_by_slug    = self::get_merged_preset_by_slug( $preset_per_origin, $preset['value_key'] );
		foreach ( $preset['classes'] as $class ) {
			foreach ( $preset_by_slug as $slug => $value ) {
				$stylesheet .= self::to_ruleset(
					self::append_to_selector( $selector, '.has-' . _wp_to_kebab_case( $slug ) . '-' . $class['class_suffix'] ),
					array(
						array(
							'name'  => $class['property_name'],
							'value' => 'var(--wp--preset--' . $preset['css_var_infix'] . '--' . _wp_to_kebab_case( $slug ) . ') !important',
						),
					)
				);
			}
		}
	}

	return $stylesheet;
}