GravityView  2.1.1
The best, easiest way to display Gravity Forms entries on your website.
field-address-html.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 $field_id = $gravityview->field->ID;
9 $field = $gravityview->field->field;
10 $value = $gravityview->value;
11 $display_value = $gravityview->display_value;
12 $entry = $gravityview->entry->as_entry();
13 $field_settings = $gravityview->field->as_configuration();
14 $is_single_input = floor( $field_id ) !== floatval( $field_id );
15 
16 // If it's the full address
17 if ( ! $is_single_input ) {
18 
19  /**
20  * Make sure we're only showing enabled inputs.
21  */
22  foreach ( $field->inputs as $input ) {
23  if ( ! empty( $input['isHidden'] ) ) {
24  unset( $value["{$input['id']}"] );
25  }
26  }
27 
28  /**
29  * Add map link if it's not set (default, back compat) or if it's set to yes
30  */
31  if ( isset( $field_settings['show_map_link'] ) && ! $field_settings['show_map_link'] ) {
32  /** Add the map link as another line. */
33  add_filter( 'gform_disable_address_map_link', '__return_true' );
34  $map_disabled = true;
35  }
36 
37  /**
38  * Use Gravity Forms' method to get the full address.
39  */
40  $value_with_newline = GFCommon::get_lead_field_display( $field, $value, "", false, 'html' );
41 
42  if ( ! empty( $map_disabled ) ) {
43  remove_filter( 'gform_disable_address_map_link', '__return_true' );
44  }
45 
46  if ( empty( $value_with_newline ) ) { return; }
47 
48  // Full address without the "Map It" link
49  echo str_replace( "\n", '<br />', $value_with_newline );
50 
51 } else {
53 }
$field_id
The default address field output template.
gravityview_get_field_value( $entry, $field_id, $display_value)
Handle getting values for complex Gravity Forms fields.
Definition: class-api.php:871
$display_value
$field_settings
$is_single_input