Skip to content

Commit

Permalink
fix: return default value for FieldWithFileSize.maxFileSize
Browse files Browse the repository at this point in the history
  • Loading branch information
justlevine committed Aug 2, 2024
1 parent 1bfd3e0 commit 90f75b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
## [Unreleased]

- fix: Check if classes are loaded by a different autoloader before attempting to autoload them. H/t @cvanh
- fix: Return `wp_max_upload_size()` instead of `null` if `FieldWithFileSize.maxFileSize` is `null`. H/t @Gytjarek
- ci: Replace calls to `docker-compose` with `docker compose`.


## v0.13.0

**:warning: This release contains multiple breaking changes.**
Expand Down
4 changes: 4 additions & 0 deletions src/Type/WPInterface/FieldSetting/FieldWithFileSize.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public static function get_fields(): array {
'maxFileSize' => [
'type' => 'Int',
'description' => __( 'The maximum size (in MB) an uploaded file may be .', 'wp-graphql-gravity-forms' ),
'resolve' => static function ( $source ) {
// Fall back to the WP max upload size if the field setting is not set, to mimic GF frontend behavior.
return ! empty( $source->maxFileSize ) ? (int) $source->maxFileSize : ( wp_max_upload_size() / 1048576 );
},
],
];
}
Expand Down

0 comments on commit 90f75b0

Please sign in to comment.