GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-business_hours-csv.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default field output template for CSVs.
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 $display_value = $gravityview->display_value;
16 $value = $gravityview->value;
17 $entry = $gravityview->entry->as_entry();
18 
19 if ( $value = json_decode( $value ) ) {
20  $output = array();
21  foreach ( $value as $day ) {
22  $output[] = sprintf( '%s %s - %s', $day->daylabel, $day->fromtime, $day->totimelabel );
23  }
24 
25  /**
26  * @filter `gravityview/template/field/csv/glue` The value used to separate multiple values in the CSV export
27  * @since 2.4.2
28  *
29  * @param string The glue. Default: ";" (semicolon)
30  * @param \GV\Template_Context The context.
31  */
32  $glue = apply_filters( 'gravityview/template/field/csv/glue', ";", $gravityview );
33 
34  echo implode( $glue, $output );
35 }
if(! isset( $gravityview)||empty( $gravityview->template)) $field_id
The default field output template for CSVs.
gravityview()
The main GravityView wrapper function.