GravityView  2.17
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  /** We shall output the map ourselves for now, suppress the output here. */
28  add_filter( 'gform_disable_address_map_link', '__return_true' );
29 
30  // Use Gravity Forms' method to get the full address.
31  $value_with_newline = GFCommon::get_lead_field_display( $field, $value, "", false, 'html' );
32 
33  remove_filter( 'gform_disable_address_map_link', '__return_true' );
34 
35  if( empty( $value_with_newline ) ) { return; }
36 
37  // Add map link if it's not set (default, back compat) or if it's set to yes
38  if( !isset( $field_settings['show_map_link'] ) || !empty( $field_settings['show_map_link'] ) ) {
39  $atts = array();
40 
41  if ( $field_settings['show_map_link_new_window'] ) {
42  $atts['target'] = '_blank';
43  }
44 
45  // Add the map link as another line
46  $value_with_newline .= "\n" . gravityview_get_map_link( $value_with_newline, $atts );
47  }
48 
49  // Full address without the "Map It" link
50  echo str_replace("\n", '<br />', $value_with_newline );
51 
52 } else {
53 
55 
56 }
gravityview_get_field_value( $entry, $field_id, $display_value)
Handle getting values for complex Gravity Forms fields.
Definition: class-api.php:1034
static getInstance( $passed_post=NULL)
$display_value
gravityview_get_map_link( $address, $atts=array())
Generate a mapping link from an address.
Definition: class-api.php:1406
$field_settings['content']
Definition: custom.php:27
$gravityview_view
Definition: address.php:10
$entry
Definition: notes.php:27
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed
Definition: time.php:22