GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
address.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Address field output, with "Map It" link removed
4  *
5  * @package GravityView
6  * @subpackage GravityView/templates/fields
7  *
8  */
9 
11 
12 extract( $gravityview_view->getCurrentField() );
13 
14 // If it's the full address
15 if( floor( $field_id ) === floatval( $field_id ) ) {
16 
17  /**
18  * Make sure we're only showing enabled inputs.
19  * @since 1.16.2
20  */
21  foreach( $field->inputs as $input ) {
22  if( ! empty( $input['isHidden'] ) ) {
23  unset( $value["{$input['id']}"] );
24  }
25  }
26 
27  // @todo Implement the `gform_disable_address_map_link` filter (boolean) added in GF 1.9 to enable/disable map link
28  // Use Gravity Forms' method to get the full address.
29  // Pass the `text` parameter so the map link isn't added like when passing `html`
30  $value_with_newline = GFCommon::get_lead_field_display( $field, $value, "", false, 'text' );
31 
32  if( empty( $value_with_newline ) ) { return; }
33 
34  // Add map link if it's not set (default, back compat) or if it's set to yes
35  if( !isset( $field_settings['show_map_link'] ) || !empty( $field_settings['show_map_link'] ) ){
36 
37  // Add the map link as another line
38  $value_with_newline .= "\n" . gravityview_get_map_link( $value_with_newline );
39 
40  }
41 
42  // Full address without the "Map It" link
43  echo str_replace("\n", '<br />', $value_with_newline );
44 
45 } else {
46 
47  echo gravityview_get_field_value( $entry, $field_id, $display_value );
48 
49 }
gravityview_get_field_value($entry, $field_id, $display_value)
Handle getting values for complex Gravity Forms fields.
Definition: class-api.php:859
$gravityview_view
Definition: address.php:10
$field_settings['content']
Definition: custom.php:27
$field_id
Definition: time.php:17
gravityview_get_map_link($address)
Generate a mapping link from an address.
Definition: class-api.php:1110
static getInstance($passed_post=NULL)
$entry
Definition: notes.php:27
$field
Definition: gquiz_grade.php:11