Converts font-face properties from theme.json format.
Parameters
$font_face_definition
arrayrequired- The font-face definitions to convert.
$font_family_property
stringrequired- The value to store in the font-face font-family property.
Source
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;
}
Changelog
Version | Description |
---|---|
6.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.