Parse font-family name from comma-separated lists.
Description
If the given fontFamily
is a comma-separated lists (example: "Inter, sans-serif" ), parse and return the fist font from the list.
Parameters
$font_family
stringrequired- Font family `fontFamily’ to parse.
Source
private static function maybe_parse_name_from_comma_separated_list( $font_family ) {
if ( str_contains( $font_family, ',' ) ) {
$font_family = explode( ',', $font_family )[0];
}
return trim( $font_family, "\"'" );
}
Changelog
Version | Description |
---|---|
6.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.