The gform_dropbox_store_local_version filter allows you to decide whether to keep a local copy of the file after it has been uploaded to Dropbox.
Usage
A generic example for all forms:
add_filter('gform_dropbox_store_local_version', 'your_function_name', 10, 6);
To target a specific form, append the form ID to the hook name:
add_filter('gform_dropbox_store_local_version_10', 'your_function_name', 10, 6);
To target a specific field, append both the form ID and field ID to the hook name:
add_filter('gform_dropbox_store_local_version_10_3', 'your_function_name', 10, 6);
Parameters
- $store_local_version (boolean): Should a local copy of the file be retained? Default is false.
- $file (array): The file properties (name, path, URL, and destination).
- $field_id (string): The ID of the field currently being processed.
- $form (Form Object): The form currently being processed.
- $entry (Entry Object): The entry currently being processed.
- $feed (Feed Object): The feed currently being processed.
More information
See Gravity Forms Docs: gform_dropbox_store_local_version
Examples
Simple Usage
This example demonstrates the simplest way to use the hook:
add_filter('gform_dropbox_store_local_version', '__return_true');
Advanced Usage
This example demonstrates how to decide if a local copy should be retained based on the name of the feed and a field value in the Entry Object:
add_filter('gform_dropbox_store_local_version_10', 'maybe_store_local_version', 10, 6); function maybe_store_local_version($store_local_version, $file, $field_id, $form, $entry, $feed) { if (rgars($feed, 'meta/feedName') == 'Dropbox Feed 2' && rgar($entry, '5') == 'No') { return true; } return $store_local_version; }
Place this code in the functions.php
file of your active theme.