Automattic\WooCommerce\Internal\Font
FontFamily::validate_font_family
Validates a font family.
Метод класса: FontFamily{}
Хуков нет.
Возвращает
\WP_Error|null. The error if the font family is invalid, null otherwise.
Использование
$result = FontFamily::validate_font_family( $font_family );
- $font_family(массив) (обязательный)
- The font family settings.
Код FontFamily::validate_font_family() FontFamily::validate font family WC 10.4.3
private static function validate_font_family( $font_family ) {
// Validate the font family name.
if ( empty( $font_family['fontFamily'] ) ) {
return new \WP_Error(
'invalid_font_family_name',
__( 'The font family name is required.', 'woocommerce' ),
);
}
// Validate the font family slug.
if ( empty( $font_family['preview'] ) ) {
return new \WP_Error(
'invalid_font_family_name_preview',
__( 'The font family preview is required.', 'woocommerce' ),
);
}
}