GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
website.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Display the website field type
4  *
5  * @package GravityView
6  * @subpackage GravityView/templates/fields
7  */
8 
10 
11 extract( $gravityview_view->getCurrentField() );
12 
13 if( !empty( $value ) && function_exists( 'gravityview_format_link' ) ) {
14  $value = esc_url_raw( $value );
15 
16  /** @since 1.8 */
17  $anchor_text = ! empty( $field_settings['anchor_text'] ) ? trim( rtrim( \GV\Utils::get( $field_settings, 'anchor_text', '' ) ) ) : false;
18 
19  // Check empty again, just in case trim removed whitespace didn't work
20  if( !empty( $anchor_text ) ) {
21 
22  // Replace the variables
23  $anchor_text = GravityView_API::replace_variables( $anchor_text, $form, $entry );
24 
25  } else {
26  $anchor_text = empty( $field_settings['truncatelink'] ) ? $value : gravityview_format_link( $value );
27  }
28 
29  $attributes = '';
30 
31  if ( empty( $field_settings['open_same_window'] ) && ! empty( $field_settings['new_window'] ) ) {
32  $attributes = 'target=_blank';
33  }
34 
35  echo gravityview_get_link( $value, $anchor_text, $attributes );
36 
37 } else {
38  echo esc_html( esc_url_raw( $value ) );
39 }
static getInstance( $passed_post=NULL)
$field_settings['content']
Definition: custom.php:27
gravityview_get_link( $href='', $anchor_text='', $atts=array())
Generate an HTML anchor tag with a list of supported attributes.
if(gravityview() ->plugin->is_GF_25()) $form
gravityview_format_link( $value=null)
Convert a whole link into a shorter link for display.
static replace_variables( $text, $form=array(), $entry=array(), $url_encode=false, $esc_html=true, $nl2br=true, $format='html', $aux_data=array())
Alias for GravityView_Merge_Tags::replace_variables()
Definition: class-api.php:118
$entry
Definition: notes.php:27
$gravityview_view
Definition: website.php:9