GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Static Public Member Functions | Data Fields | Static Private Member Functions
GravityView_Field_FileUpload Class Reference
Inheritance diagram for GravityView_Field_FileUpload:
GravityView_Field

Public Member Functions

 __construct ()
 
 field_options ( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
 
 get_field_input ( $form, $field_value, $entry, $field)
 Trick the GF fileupload field to render with the proper HTML ID to enable the plupload JS to work properly. More...
 
- Public Member Functions inherited from GravityView_Field
 __construct ()
 GravityView_Field constructor. More...
 
 _filter_gform_custom_merge_tags ( $custom_merge_tags=array(), $form_id=0, $fields=array(), $element_id='')
 Add custom merge tags to merge tag options. More...
 
 _filter_gform_replace_merge_tags ( $text, $form=array(), $entry=array(), $url_encode=false, $esc_html=false)
 Match the merge tag in replacement text for the field. More...
 
 _filter_sortable_fields ( $not_sortable)
 Use field settings to modify whether a field is sortable. More...
 
 add_entry_meta ( $entry_meta)
 Add the custom entry meta key to make it searchable and sortable. More...
 
 add_field_support ( $key, &$field_options)
 
 add_sortable_field ( $fields)
 Add the field to the Filter & Sort available fields. More...
 
 as_array ()
 Returns the field as an array to be used in field pickers. More...
 
 field_options ( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
 Tap in here to modify field options. More...
 
 replace_merge_tag ( $matches=array(), $text='', $form=array(), $entry=array(), $url_encode=false, $esc_html=false)
 Run GravityView filters when using GFCommon::replace_variables() More...
 
 set_default_search_label ( $label='', $gf_field=null, $field=array())
 Allow setting a default search label for search fields based on the field type. More...
 

Static Public Member Functions

static get_files_array ( $value, $gv_class, $context=null)
 Return an array of files prepared for output. More...
 

Data Fields

 $_gf_field_class_name = 'GF_Field_FileUpload'
 
 $group = 'advanced'
 
 $icon = 'dashicons-upload'
 
 $is_searchable = true
 
 $name = 'fileupload'
 
 $search_operators = array( 'contains' )
 
- Data Fields inherited from GravityView_Field
 $_gf_field_class_name
 
 $contexts = array( 'single', 'multiple', 'edit', 'export' )
 
 $default_search_label
 
 $description
 
 $entry_meta_is_default_column = false
 
 $entry_meta_key = null
 
 $entry_meta_update_callback = null
 
 $group
 standard, advanced, post, pricing, meta, gravityview, or add-ons More...
 
 $icon = 'dashicons-admin-generic'
 
 $is_numeric
 boolean Is field content number-based? More...
 
 $is_searchable = true
 
 $is_sortable = true
 boolean Can the field be sorted in search? More...
 
 $label
 
 $name
 
 $search_operators
 

Static Private Member Functions

static get_file_info ( $file_path, $field, $field_settings, $context, $index)
 Prepares information about the file. More...
 
static replace_insecure_wp_shortcode_output ( $rendered='', $insecure_file_path='', $secure_file_path='')
 Replaces insecure file paths with secure file paths for WordPress media shortcode output. More...
 

Additional Inherited Members

- Protected Member Functions inherited from GravityView_Field
 custom_merge_tags ( $form=array(), $fields=array())
 Add custom Merge Tags to Merge Tag options, if custom Merge Tags exist. More...
 
 is_choice_value_enabled ()
 Check whether the enableChoiceValue flag is set for a GF field. More...
 
- Protected Attributes inherited from GravityView_Field
 $_custom_merge_tag = false
 
 $_field_id = ''
 
 $_field_options = array()
 

Detailed Description

Definition at line 8 of file class-gravityview-field-fileupload.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Definition at line 22 of file class-gravityview-field-fileupload.php.

Member Function Documentation

◆ field_options()

field_options (   $field_options,
  $template_id,
  $field_id,
  $context,
  $input_type,
  $form_id 
)

Definition at line 27 of file class-gravityview-field-fileupload.php.

References $field, $field_id, $form_id, and GF_Field\by_id().

◆ get_field_input()

get_field_input (   $form,
  $field_value,
  $entry,
  $field 
)

Trick the GF fileupload field to render with the proper HTML ID to enable the plupload JS to work properly.

Parameters
array$formThe Form Object currently being processed.
string | array$valueThe field value. From default/dynamic population, $_POST, or a resumed incomplete submission.
null | array$entryNull or the Entry Object currently being edited.
GF_Field_FileUpload$fieldGravity Forms field
Returns
string

Definition at line 80 of file class-gravityview-field-fileupload.php.

References $entry, $field, $field_value, and GV\$form.

◆ get_file_info()

static get_file_info (   $file_path,
  $field,
  $field_settings,
  $context,
  $index 
)
staticprivate

Prepares information about the file.

Since
2.16
Parameters
string$file_pathThe file path as returned from Gravity Forms.
GF_Field_FileUpload$fieldThe file upload field.
array$field_settingsGravityView settings for the field {
See also
::as_configuration()}
Parameters
\GV\Template_Context$context
int$indexThe index of the current file in the array of files.
Returns
array{file_path: string, insecure_file_path: string,secure_file_path: string,basename:string,extension:string,is_secure: bool}
Runs Filter:
gravityview/fields/fileupload/extension Modify the file extension before it's used in display logic
Since
2.13.5
Parameters
string$extensionThe extension of the file, as parsed by pathinfo().
string$file_pathPath to the file uploaded by Gravity Forms.
Runs Filter:
gravityview/fields/fileupload/file_path Modify the file path before generating a link to it
Since
1.22.3
2.0 Added $context parameter
2.8.2
Parameters
string$file_pathPath to the file uploaded by Gravity Forms
array$field_settingsArray of GravityView field settings
\GV\Template_Context$contextThe context.
int$indexThe current index of the $file_paths array being processed

Definition at line 428 of file class-gravityview-field-fileupload.php.

References $field, and $field_settings.

◆ get_files_array()

static get_files_array (   $value,
  $gv_class,
  $context = null 
)
static

Return an array of files prepared for output.

Processes files by file type and generates unique output for each. Returns array for each file, with the following keys:

  • file_path => The file path of the file, with a line break
  • html => The file output HTML formatted
Since
1.2
Parameters
string$valueField value passed by Gravity Forms. String of file URL, or serialized string of file URL array
string$gv_classField class to add to the output HTML
Since
2.0
Parameters

A compatibility array that's required by some of the deprecated filters.

GF_Field_FileUpload $field

Runs Filter:
gravityview_audio_settings Modify the settings passed to the wp_video_shortcode() function
Since
1.2
Parameters
array$audio_settingsArray with src and class keys
Since
2.0
Parameters
\GV\Template_Context$contextThe context.

Generate the audio shortcode

See also
http://codex.wordpress.org/Audio_Shortcode
https://developer.wordpress.org/reference/functions/wp_audio_shortcode/
Runs Filter:
gravityview_video_settings Modify the settings passed to the wp_video_shortcode() function
Since
1.2
Parameters
array$video_settingsArray with src and class keys
Since
2.0
Parameters
\GV\Template_Context$contextThe context.

Generate the video shortcode

See also
http://codex.wordpress.org/Video_Shortcode
https://developer.wordpress.org/reference/functions/wp_video_shortcode/

Modify the default image attributes for uploaded images

Since
2.0
See also
GravityView_Image For the available attributes
Parameters
array$image_atts
Runs Filter:
gravityview/fields/fileupload/disable_link Filter to alter the default behaviour of wrapping images (or image names) with a link to the content object
Since
1.5.1
Parameters
bool$disable_wrapped_linkwhether to wrap the content with a link to the content object.
array$field_compatCurrent GravityView field array
See also
GravityView_API:field_value() for info about $gravityview_view->field_data
Since
2.0
Parameters
\GV\Template_Context$contextThe context.

Modify the link text (defaults to the file name)

Since
1.7
Parameters
string$contentThe existing anchor content. Could be <img> tag, audio/video embed or the file name
array$field_compatCurrent GravityView field array
Since
2.0
Parameters
\GV\Template_Context$contextThe context.
Runs Filter:
gravityview/fields/fileupload/link_atts Modify the link attributes for a file upload field
Since
2.0 Added $context
2.11 Added $additional_details
Parameters
array | string$link_attsArray or attributes string
array$field_compatCurrent GravityView field array
\GV\Template_Context$contextThe context.
array$additional_detailsArray of additional details about the file. { string $file_path URL to file. string $insecure_file_path URL to insecure file. }
Runs Filter:
gravityview/fields/fileupload/files_array Modify the files array
Since
1.7
2.0 Added $context
Parameters
array$output_arrAssociative array of files. { string $file_path The path to the file as stored in Gravity Forms. string $content The generated output for the file. }
array$field_compatCurrent GravityView field array.
\GV\Template_Context$contextThe context.

Definition at line 135 of file class-gravityview-field-fileupload.php.

References $alt, $content, $entry, $entry_slug, $field, $field_settings, $field_value, $gravityview_view, $image, $image_atts, $link_atts, $post, $value, GF_Entry\from_entry(), Utils\get(), GravityView_Image\get_image_extensions(), GravityView_View\getInstance(), gravityview(), gravityview_get_context(), and gravityview_get_link().

Referenced by gravityview_get_files_array().

◆ replace_insecure_wp_shortcode_output()

static replace_insecure_wp_shortcode_output (   $rendered = '',
  $insecure_file_path = '',
  $secure_file_path = '' 
)
staticprivate

Replaces insecure file paths with secure file paths for WordPress media shortcode output.

The WordPress media shortcodes need to be passed insecure file paths so WordPress can parse the extension] that is being rendered and properly generate the code. Once that shortcode is rendered, we then replace the insecure file paths with the secure file paths used by Gravity Forms.

Since
2.10.3
Parameters
string$renderedThe output of the WordPress audio/video shortcodes.
string$insecure_file_pathInsecure path to the file, showing the directory structure.
string$secure_file_pathSecure file path using Gravity Forms rewrites.
Returns
string HTML output with insecure file paths converted to secure.

Definition at line 104 of file class-gravityview-field-fileupload.php.

Field Documentation

◆ $_gf_field_class_name

$_gf_field_class_name = 'GF_Field_FileUpload'

Definition at line 12 of file class-gravityview-field-fileupload.php.

◆ $group

$group = 'advanced'

Definition at line 18 of file class-gravityview-field-fileupload.php.

◆ $icon

$icon = 'dashicons-upload'

Definition at line 20 of file class-gravityview-field-fileupload.php.

◆ $is_searchable

$is_searchable = true

Definition at line 14 of file class-gravityview-field-fileupload.php.

◆ $name

$name = 'fileupload'

Definition at line 10 of file class-gravityview-field-fileupload.php.

◆ $search_operators

$search_operators = array( 'contains' )

Definition at line 16 of file class-gravityview-field-fileupload.php.


The documentation for this class was generated from the following file: