@todo replace with `wp_trigger_error()`.
_doing_it_wrong(
__METHOD__,
__( 'Font src must be a non-empty string or an array of strings.' ),
'6.4.0'
);
return false;
}
// Validate the 'src' property.
foreach ( (array) $font_face['src'] as $src ) {
if ( empty( $src ) || ! is_string( $src ) ) {
// @todo replace with `wp_trigger_error()`.
_doing_it_wrong(
__METHOD__,
__( 'Each font src must be a non-empty string.' ),
'6.4.0'
);
return false;
}
}
// Check the font-weight.
if ( ! is_string( $font_face['font-weight'] ) && ! is_int( $font_face['font-weight'] ) ) {
// @todo replace with `wp_trigger_error()`.
_doing_it_wrong(
__METHOD__,
__( 'Font font-weight must be a properly formatted string or integer.' ),
'6.4.0'
);
return false;
}
// Check the font-display.
if ( ! in_array( $font_face['font-display'], $this->valid_font_display, true ) ) {
$font_face['font-display'] = $this->font_face_property_defaults['font-display'];
}
// Remove invalid properties.
foreach ( $font_face as $property => $value ) {
if ( ! in_array( $property, $this->valid_font_face_properties, true ) ) {
unset( $font_face[ $property ] );
}
}
return $font_face;
}
/**
* Gets the style element for wrapping the `@font-face` CSS.
*
* @since 6.4.0
*
* @return string The style element.
*/
private function get_style_element() {
$attributes = $this->generate_style_element_attributes();
return "\n";
}
/**
* Gets the defined