Skip to content

Commit

Permalink
fix: return default value for FieldWithFileSize.maxFileSize (#443)
Browse files Browse the repository at this point in the history
* chore: update composer dev-deps

* fix: check if classes are loaded by a different autoloader

* chore: add props

* ci: replace `docker-compose` with `docker compose`

* fix: return default value for `FieldWithFileSize.maxFileSize`

* chore: fix changelog
  • Loading branch information
justlevine authored Aug 2, 2024
1 parent d190465 commit dfeded3
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 `GfFieldWithFileSizeSetting.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 dfeded3

Please sign in to comment.