GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-post_category-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default post_category 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 $value = $gravityview->value;
16 $entry = $gravityview->entry->as_entry();
17 $field_settings = $gravityview->field->as_configuration();
18 
19 if ( ! empty( $field_settings['dynamic_data'] ) ) {
20 
21  $term_list = gravityview_get_the_term_list( $entry['post_id'], $field_settings['link_to_term'], 'category' );
22 
23  if( empty( $term_list ) ) {
24  do_action( 'gravityview_log_debug', 'Dynamic data for post #' . $entry['post_id'] . ' doesnt exist.' );
25  }
26 
27  echo $term_list;
28 
29 } else {
30 
31  if ( empty( $field_settings['link_to_term'] ) ) {
32 
33  echo wp_kses( $display_value,
34  array(
35  'ul' => array( 'class' => true ), 'li' => array(),
36  )
37  );
38 
39  } else {
40 
42  }
43 }
if(! isset( $gravityview)||empty( $gravityview->template)) $display_value
The default post_category field output template.
gravityview_get_the_term_list( $post_id, $link=true, $taxonomy='post_tag')
Get the links for post_tags and post_category output based on post ID.
Definition: class-api.php:1115
$value
$field_settings
$entry
gravityview_convert_value_to_term_list( $value, $taxonomy='post_tag')
Take a passed CSV of terms and generate a linked list of terms.
Definition: class-api.php:1060
gravityview()
The main GravityView wrapper function.