GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-list-csv.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default list field output template.
4  *
5  * @global \GV\Template_Context $gravityview
6  * @since 2.0
7  */
8 
9 if ( ! isset( $gravityview ) || empty( $gravityview->template ) ) {
10  gravityview()->log->error( '{file} template loaded without context', array( 'file' => __FILE__ ) );
11  return;
12 }
13 
14 $field_id = $gravityview->field->ID;
15 $field = $gravityview->field->field;
16 $value = $gravityview->value;
17 $display_value = $gravityview->display_value;
18 
20 
21 if ( $field->enableColumns && false !== $column_id ) {
22 
23  /**
24  * @filter `gravityview/fields/list/column-format` Format of single list column output of a List field with Multiple Columns enabled
25  * @since 1.14
26  * @param string $format `html` (for <ul> list), `text` (for CSV output)
27  * @since 2.0
28  * @param \GV\Template_Context $gravityview The context
29  */
30  $format = apply_filters( 'gravityview/fields/list/column-format', 'text', $gravityview );
31 
33 
34 } else {
35 
36  /**
37  * @filter `gravityview/template/field/csv/glue` The value used to separate multiple values in the CSV export
38  * @since 2.4.2
39  *
40  * @param string The glue. Default: ";" (semicolon)
41  * @param \GV\Template_Context The context.
42  */
43  $glue = apply_filters( 'gravityview/template/field/csv/glue', ";", $gravityview );
44 
45  $value = unserialize( $value );
46  if ( $field->enableColumns ) {
47  $columns = array_keys( current( $value ) );
48  echo implode( ',', $columns ) . $glue;
49  }
50 
51  $output = array();
52  foreach ( $value as $column ) {
53  $output[] = is_array($column) ? implode( ',', $column ) : $column;
54  }
55 
56  echo implode( $glue, $output );
57 }
$value
if(gv_empty( $field['value'], false, false)) $format
gravityview_get_input_id_from_id( $field_id='')
Very commonly needed: get the # of the input based on a full field ID.
$display_value
if( $field->enableColumns) $output
gravityview()
The main GravityView wrapper function.
$field
if(! isset( $gravityview)||empty( $gravityview->template)) $field_id
The default list field output template.
$column_id
static column_value(GF_Field_List $field, $field_value, $column_id=0, $format='html')
Get the value of a Multiple Column List field for a specific column.