GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-address-csv.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default address 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 $entry = $gravityview->entry->as_entry();
19 $field_settings = $gravityview->field->as_configuration();
20 $is_single_input = floor( $field_id ) !== floatval( $field_id );
21 
22 // If it's the full address
23 if ( ! $is_single_input ) {
24 
25  /**
26  * Make sure we're only showing enabled inputs.
27  */
28  foreach ( $field->inputs as $input ) {
29  if ( ! empty( $input['isHidden'] ) ) {
30  unset( $value["{$input['id']}"] );
31  }
32  }
33 
34  add_filter( 'gform_disable_address_map_link', '__return_true' );
35 
36  /**
37  * Use Gravity Forms' method to get the full address.
38  */
39  $value_with_newline = GFCommon::get_lead_field_display( $field, $value, "", false, 'text' );
40 
41  remove_filter( 'gform_disable_address_map_link', '__return_true' );
42 
43  $address = explode( "\n", $value_with_newline );
44 
45  if ( empty( $address ) ) {
46  return;
47  }
48 
49  /**
50  * @filter `gravityview/template/field/address/csv/delimiter` The address parts delimiter.
51  * @since develop
52  * @param string The delimiter. Default: newline
53  * @param \GV\Template_Context The context.
54  */
55  $delimiter = apply_filters( 'gravityview/template/field/address/csv/delimiter', "\n", $gravityview );
56 
57  echo implode( $delimiter, $address );
58 } else {
60 }
gravityview_get_field_value( $entry, $field_id, $display_value)
Handle getting values for complex Gravity Forms fields.
Definition: class-api.php:1034
$display_value
$field_settings
$is_single_input
gravityview()
The main GravityView wrapper function.
if(! isset( $gravityview)||empty( $gravityview->template)) $field_id
The default address field output template.