GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
fileupload.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Display the fileupload field type
4  *
5  * @package GravityView
6  * @subpackage GravityView/templates/fields
7  */
8 
10 
11 extract( $gravityview_view->getCurrentField() );
12 
13 $output = '';
14 
15 if( !empty( $value ) ){
16 
17  $gv_class = gv_class( $field, $gravityview_view->getForm(), $entry );
18 
19  $output_arr = gravityview_get_files_array( $value, $gv_class );
20 
21  // If the output array is just one item, let's not show a list.
22  if( sizeof( $output_arr ) === 1 ) {
23 
24  $output = $output_arr[0]['content'];
25 
26  }
27 
28  // There are multiple files
29  else {
30 
31  // For each file, show as a list
32  foreach ( $output_arr as $key => $item) {
33 
34  // Fix empty lists
35  if( empty( $item['content'] ) ) { continue; }
36 
37  $output .= '<li>' . $item['content'] . '</li>';
38  }
39 
40  if( !empty( $output ) ) {
41 
42  $output = sprintf("<ul class='gv-field-file-uploads %s'>%s</ul>", $gv_class, $output );
43 
44  }
45  }
46 
47 }
48 
49 echo $output;
static getInstance( $passed_post=NULL)
gravityview_get_files_array( $value, $gv_class='', $context=null)
Return an array of files prepared for output.
Definition: class-api.php:1375
$gravityview_view
Definition: fileupload.php:9
$output
Definition: fileupload.php:13
gv_class( $field, $form=NULL, $entry=array())
Definition: class-api.php:840
$entry
Definition: notes.php:27