Automattic\WooCommerce\Internal\Font
FontFamily::validate_font_family()
Validates a font family.
Method of the class: FontFamily{}
No Hooks.
Return
\WP_Error|null
. The error if the font family is invalid, null otherwise.
Usage
$result = FontFamily::validate_font_family( $font_family );
- $font_family(array) (required)
- The font family settings.
FontFamily::validate_font_family() FontFamily::validate font family code WC 9.5.1
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' ), ); } }