Skip to content

Use get_input_type() when checking File Upload and Post Image fields #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jakejackson1
Copy link

@jakejackson1 jakejackson1 commented Apr 27, 2025

Gravity Forms is highly extensible and this lets developers build new fields based on the existing fields. When developers do this it requires a unique string to be set for $gf_field->type, but in most cases you can maintain the original field's functionality by setting the $gf_field->inputType back to the original type. This specific feature is how Gravity Forms builds add-ons like Polls and Surveys – which extend the radio and checkbox fields – and how the Custom Field post field works.

This PR switches to get_input_type() when processing file upload and post image fields. This change will allow Image Hopper (any other fields that extend these two fields) to be correctly processed by Pods on form submission.

This change should likely be done for all references to $gf_field->type. However, to make this PR easy to test/verify and to prevent any unexpected issues with other fields, I've limited it only to those that reference fileupload and post_image types. I've a bunch of experience testing and implementing this specific change for Gravity Forms, and this modification poses a very low risk of causing an issue. I won't say no risk, because nothing is 100% certain in an ecosystem like WordPress, but I haven't discovered any breaking changes caused by making this switch elsewhere.

Gravity Forms is highly extensible and this lets developers build new fields based on the existing fields. When developers do this it requires a unique string to be set for `$gf_field->type`, but in most cases you can maintain the original field's functionality by setting the `$gf_field->inputType` back to the original type. This specific feature is how Gravity Forms builds add-ons like Polls and Surveys, which extend the radio and checkbox fields. 

This PR switches to `get_input_type()` when processing file upload and post image fields. This change will allow [Image Hopper](https://imagehopper.tech/) (any other fields that extend these two fields) to be correctly processed by Pods on form submission.

This change should likely be done for all references to `$gf_field->type`. However, to make this PR easy to test/verify and to prevent any unexpected issues with other fields, I've limited it only to those that reference `fileupload` and `post_image` types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant