WP_Font_Face_Resolver::convert_font_face_properties
Converts font-face properties from theme.json format.
Method of the class: WP_Font_Face_Resolver{}
No Hooks.
Returns
Array. Converted font-face properties.
Usage
$result = WP_Font_Face_Resolver::convert_font_face_properties( $font_face_definition, $font_family_property );
- $font_face_definition(array) (required)
- The font-face definitions to convert.
- $font_family_property(string) (required)
- The value to store in the font-face font-family property.
Changelog
| Since 6.4.0 | Introduced. |
WP_Font_Face_Resolver::convert_font_face_properties() WP Font Face Resolver::convert font face properties code WP 7.0
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;
}