[redux] Coerce variable type of form field argument 'class' in woocommerce_form_field() (#33454)

Co-authored-by: hahn208 <208hahn@gmail.com>
This commit is contained in:
Jorge A. Torres 2022-06-16 10:35:22 -03:00 committed by GitHub
parent a78670bfec
commit 6627fdb5ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Allow strings to be passed as 'class' arg to '`woocommerce_form_field()`

View File

@ -2760,6 +2760,10 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$args = wp_parse_args( $args, $defaults );
$args = apply_filters( 'woocommerce_form_field_args', $args, $key, $value );
if ( is_string( $args['class'] ) ) {
$args['class'] = array( $args['class'] );
}
if ( $args['required'] ) {
$args['class'][] = 'validate-required';
$required = '&nbsp;<abbr class="required" title="' . esc_attr__( 'required', 'woocommerce' ) . '">*</abbr>';