Skip to content

Commit

Permalink
Add required attribute to file input field (#2846)
Browse files Browse the repository at this point in the history
  • Loading branch information
yscik authored Aug 27, 2024
1 parent a909c7d commit f89a227
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion templates/form-fields/file-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
type="file"
class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>"
data-file_types="<?php echo esc_attr( implode( '|', $allowed_mime_types ) ); ?>"
<?php if ( ! empty( $field['multiple'] ) ) echo 'multiple'; ?>
<?php if ( ! empty( $field['required'] ) ) echo ' required'; ?>
<?php if ( ! empty( $field['multiple'] ) ) echo ' multiple'; ?>
<?php if ( $file_limit ) echo ' data-file_limit="' . absint( $file_limit ) . '"';?>
<?php if ( ! empty( $field['file_limit_message'] ) ) echo ' data-file_limit_message="' . esc_attr( $field['file_limit_message'] ) . '"';?>
name="<?php echo esc_attr( isset( $field['name'] ) ? $field['name'] : $key ); ?><?php if ( ! empty( $field['multiple'] ) ) echo '[]'; ?>"
Expand Down

0 comments on commit f89a227

Please sign in to comment.