The gform_dropbox_should_upload_file filter allows you to determine if a file for a fileupload or dropbox type field should be uploaded to Dropbox.
Usage
Apply the filter to all forms:
add_filter('gform_dropbox_should_upload_file', 'your_function_name', 10, 7);
Target a specific form (append form ID):
add_filter('gform_dropbox_should_upload_file_2', 'your_function_name', 10, 7);
Target a specific field (append form ID and field ID):
add_filter('gform_dropbox_should_upload_file_2_3', 'your_function_name', 10, 7);
Parameters
$should_upload_file
(boolean) – Indicates if the file should be uploaded to Dropbox.$url
(string) – The URL of the file from the entry.$existing
(false | array) – False or an array of files previously uploaded to Dropbox for the current field and entry.$field
(Field Object) – The current fileupload or dropbox field object.$form
(Form Object) – The form containing the current field.$entry
(Entry Object) – The entry currently being processed.$feed
(Feed Object) – The feed currently being processed.
More information
See Gravity Forms Docs: gform_dropbox_should_upload_file
Examples
Log the parameters
This example logs the parameters available to this filter.
add_filter('gform_dropbox_should_upload_file', 'log_gform_dropbox_should_upload_file', 10, 7); add_filter('gform_dropbox_should_upload_file_18', 'log_gform_dropbox_should_upload_file', 10, 7); add_filter('gform_dropbox_should_upload_file_18_6', 'log_gform_dropbox_should_upload_file', 10, 7); function log_gform_dropbox_should_upload_file($should_upload_file, $url, $existing, $field, $form, $entry, $feed) { gf_dropbox()->log_debug(current_filter() . ': ' . print_r(func_get_args(), true)); return $should_upload_file; }
Place this code in the functions.php
file of your active theme, a custom functions plugin, or your custom add-on. This filter was added in version 3.0.1. The filter is located in GFDropbox::should_upload_file() in class-gf-dropbox.php
.