GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-source_url-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default source URL 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 $value = $gravityview->value;
15 $form = $gravityview->view->form->form;
16 $entry = $gravityview->entry->as_entry();
17 $field_settings = $gravityview->field->as_configuration();
18 
19 // If linking to the source URL
20 if ( ! empty( $field_settings['link_to_source'] ) ) {
21 
22  // If customizing the anchor text
23  if ( ! empty( $field_settings['source_link_text'] ) ) {
24 
26 
27  } else {
28 
29  // Otherwise, it's just the URL
30  $link_text = esc_html( $value );
31 
32  }
33 
35 
36 } else {
37 
38  // Otherwise, it's just the URL
39  $output = esc_url_raw( $value );
40 
41 }
42 
43 echo $output;
gravityview_get_link( $href='', $anchor_text='', $atts=array())
Generate an HTML anchor tag with a list of supported attributes.
if(! isset( $gravityview)||empty( $gravityview->template)) $value
The default source URL field output template.
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
gravityview()
The main GravityView wrapper function.