Repository navigation
Add File Upload fields to PDF conditional logic (6.18.0) - #1968
Merged
gravitypdf-bot merged 1 commit intoOct 26, 2026
Merged
Conversation
Backport of #1961: source and PHPUnit only. The Playwright spec and PHPStan baseline change stay on development. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 of 4 tasks
gravitypdf-bot
deleted the
fix-1619-file-upload-conditional-logic-6.18
branch
October 26, 2026 07:01
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of #1961 to 6.18.0. PDF conditional logic had no way to check whether a File Upload field holds a file, because Gravity Forms leaves File Upload fields out of its conditional logic field list. This adds single and multi-file File Upload fields to the PDF conditional logic UI with "is / is not Empty", and makes an empty multi-file list (
[]) count as empty.is/is notand an "Empty" value[]is treated as empty[]entriesTry it
Or by hand: add a multi-file File Upload field to a form, then in a PDF's settings enable Conditional Logic, pick the upload field, choose "is not" and "Empty", and save. Submit one entry with a file and one without: only the first gets the PDF in the entry list.
Test plan
is/is notand "Empty"Test_Form_SettingspassesMore info
Same source change as #1961 (both files applied cleanly;
Controller_Form_Settings.phpwas identical on both branches, andHelper_Data.phpdiffers only in unrelated methods). Left on development: the Playwright spec (no E2E on hot-patch branches) and the PHPStan baseline edit (6.18 has no PHPStan).The new PHPUnit tests go at the end of 6.18's
tests/phpunit/unit-tests/test-form-settings.php. development's tests create forms withgf_factory(), which 6.18 doesn't have, so they useGFAPI::add_form()instead; the assertions are unchanged.Compatibility:
GFAPI::get_field()andGF_Fields::get_all()are both older than the 2.5 Gravity Forms floor, and the value is decoded inline rather than withGF_Field_FileUpload::to_array()(Gravity Forms 2.10+). The rule evaluation relies on thegform_rule_source_valuefilter, which Gravity Forms added in 2.6.2, so on 2.5–2.6.1 the fields are listed but[]isn't treated as empty, the same limit the existing entry-meta rules already have. No PHP 7.4+ syntax.Checks run locally on the 6.18 build (own test DB):
Test_Form_Settings32 tests passing. With the two source files reverted tohot-patch-6.18.0, the new tests fail (2 errors, 2 failures). PHPCS (phpcs.xml.distandphpcompat.xml.dist) clean on the changed files. The full suite and multisite weren't run locally; CI covers them. Not checked with the real Image Hopper plugin.🤖 Generated with AI