GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-post_title-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default post_title 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 $display_value = $gravityview->display_value;
15 $entry = $gravityview->entry->as_entry();
16 $field_settings = $gravityview->field->as_configuration();
17 
18 if ( ! empty( $field_settings['dynamic_data'] ) && !empty( $entry['post_id'] ) ) {
19  $output = get_the_title( $entry['post_id'] );
20 
21  if ( empty( $output ) ) {
22  do_action( 'gravityview_log_debug', 'Dynamic data for post #'.$entry['post_id'].' doesnt exist.' );
23  }
24 
25 } else {
27 }
28 
29 // Link to the post URL?
30 if( ! empty( $field_settings['link_to_post'] ) && !empty( $entry['post_id'] ) ) {
31 
32  echo gravityview_get_link( get_permalink( $entry['post_id'] ), esc_html( $output ) );
33 
34 } else {
35  echo $output;
36 }
$field_settings
gravityview_get_link( $href='', $anchor_text='', $atts=array())
Generate an HTML anchor tag with a list of supported attributes.
$entry
if(! isset( $gravityview)||empty( $gravityview->template)) $display_value
The default post_title field output template.
gravityview()
The main GravityView wrapper function.