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

wp_apply_typography_support() WP 1.0

Add CSS classes and inline styles for font sizes to the incoming attributes array. This will be applied to the block markup in the front-end.

Хуков нет.

Возвращает

Массив. Font size CSS classes and inline styles.

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

wp_apply_typography_support( $block_type, $block_attributes );
$block_type(WP_Block_Type) (обязательный)
Block type.
$block_attributes(массив) (обязательный)
Block attributes.

Код wp_apply_typography_support() WP 5.6.2

<?php
function wp_apply_typography_support( $block_type, $block_attributes ) {
	$has_font_size_support = false;
	$classes               = array();
	$styles                = array();
	if ( property_exists( $block_type, 'supports' ) ) {
		$has_font_size_support = _wp_array_get( $block_type->supports, array( 'fontSize' ), false );
	}

	$has_line_height_support = false;
	if ( property_exists( $block_type, 'supports' ) ) {
		$has_line_height_support = _wp_array_get( $block_type->supports, array( 'lineHeight' ), false );
	}

	// Font Size.
	if ( $has_font_size_support ) {
		$has_named_font_size  = array_key_exists( 'fontSize', $block_attributes );
		$has_custom_font_size = isset( $block_attributes['style']['typography']['fontSize'] );

		// Apply required class or style.
		if ( $has_named_font_size ) {
			$classes[] = sprintf( 'has-%s-font-size', $block_attributes['fontSize'] );
		} elseif ( $has_custom_font_size ) {
			$styles[] = sprintf( 'font-size: %spx;', $block_attributes['style']['typography']['fontSize'] );
		}
	}

	// Line Height.
	if ( $has_line_height_support ) {
		$has_line_height = isset( $block_attributes['style']['typography']['lineHeight'] );
		// Add the style (no classes for line-height).
		if ( $has_line_height ) {
			$styles[] = sprintf( 'line-height: %s;', $block_attributes['style']['typography']['lineHeight'] );
		}
	}

	$attributes = array();
	if ( ! empty( $classes ) ) {
		$attributes['class'] = implode( ' ', $classes );
	}
	if ( ! empty( $styles ) ) {
		$attributes['style'] = implode( ' ', $styles );
	}

	return $attributes;
}