[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:
parent
a78670bfec
commit
6627fdb5ed
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: dev
|
||||
|
||||
Allow strings to be passed as 'class' arg to '`woocommerce_form_field()`
|
|
@ -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 = ' <abbr class="required" title="' . esc_attr__( 'required', 'woocommerce' ) . '">*</abbr>';
|
||||
|
|
Loading…
Reference in New Issue