Automattic\WooCommerce\Internal\Font
FontFace::validate_font_face()
Validates a font face.
Метод класса: FontFace{}
Хуков нет.
Возвращает
\WP_Error|null
. The error if the font family is invalid, null otherwise.
Использование
$result = FontFace::validate_font_face( $font_face );
- $font_face(массив) (обязательный)
- The font face settings.
Код FontFace::validate_font_face() FontFace::validate font face WC 9.6.1
private static function validate_font_face( $font_face ) { // Validate the font face family name. if ( empty( $font_face['fontFamily'] ) ) { return new \WP_Error( 'invalid_font_face_font_family', __( 'The font face family name is required.', 'woocommerce' ), ); } // Validate the font face font style. if ( empty( $font_face['fontStyle'] ) ) { return new \WP_Error( 'invalid_font_face_font_style', __( 'The font face font style is required.', 'woocommerce' ), ); } // Validate the font face weight. if ( empty( $font_face['fontWeight'] ) ) { return new \WP_Error( 'invalid_font_face_font_weight', __( 'The font face weight is required.', 'woocommerce' ), ); } // Validate the font face src. if ( empty( $font_face['src'] ) ) { return new \WP_Error( 'invalid_font_face_src', __( 'The font face src is required.', 'woocommerce' ), ); } }