WP_Font_Face_Resolver::convert_font_face_properties()private staticWP 6.4.0

Converts font-face properties from theme.json format.

Метод класса: WP_Font_Face_Resolver{}

Хуков нет.

Возвращает

Массив. Converted font-face properties.

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

$result = WP_Font_Face_Resolver::convert_font_face_properties( $font_face_definition, $font_family_property );
$font_face_definition(массив) (обязательный)
The font-face definitions to convert.
$font_family_property(строка) (обязательный)
The value to store in the font-face font-family property.

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

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

Код WP_Font_Face_Resolver::convert_font_face_properties() WP 6.7.1

private static function convert_font_face_properties( array $font_face_definition, $font_family_property ) {
	$converted_font_faces = array();

	foreach ( $font_face_definition as $font_face ) {
		// Add the font-family property to the font-face.
		$font_face['font-family'] = $font_family_property;

		// Converts the "file:./" src placeholder into a theme font file URI.
		if ( ! empty( $font_face['src'] ) ) {
			$font_face['src'] = static::to_theme_file_uri( (array) $font_face['src'] );
		}

		// Convert camelCase properties into kebab-case.
		$font_face = static::to_kebab_case( $font_face );

		$converted_font_faces[] = $font_face;
	}

	return $converted_font_faces;
}