Description
This filter can be used to change the type of link returned by Dropbox.
Usage
The following would apply to all forms:
add_filter( 'gform_dropbox_link_type', 'your_function_name', 10, 3 );
To target a specific form append the form id to the hook name. (format: gform_dropbox_link_type_FORMID)
add_filter( 'gform_dropbox_link_type_10', 'your_function_name', 10, 3 );
To target a specific field append both the form id and the field id to the hook name. (format: gform_dropbox_link_type_FORMID_FIELDID)
add_filter( 'gform_dropbox_link_type_10_3', 'your_function_name', 10, 3 );
Parameters
- $linkType string
The Dropbox link type. Possible values: preview (a preview link to the document for sharing) or direct (an expiring link to download the contents of the file). Default: preview.
-
$form Form Object
The form currently being processed.
-
$field_id string
The ID of the field currently being processed.
Example
This example shows how to change the link type for a specific form.
add_filter( 'gform_dropbox_link_type_10', 'change_link_type', 10, 3 );
function change_link_type( $linkType, $form, $field_id ) {
return 'direct';
}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
gf_apply_filters( 'gform_dropbox_link_type', array( $form['id'], $this->id ), 'preview', $form, $this->id )
This filter is located in GF_Field_Dropbox::get_form_inline_script_on_page_render() in class-gf-field-dropbox.php.