GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-field-section.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-gravityview-field-section.php
4  * @package GravityView
5  * @subpackage includes\fields
6  */
7 
8 /**
9  * Add custom options for HTML field
10  */
12 
13  var $name = 'section';
14 
15  var $is_searchable = false;
16 
17  var $_gf_field_class_name = 'GF_Field_Section';
18 
19  var $group = 'standard';
20 
21  var $icon = 'dashicons-minus';
22 
23  public function __construct() {
24  $this->label = esc_html__( 'Section', 'gk-gravityview' );
25 
26  parent::__construct();
27 
28  add_filter( 'gravityview_field_entry_value_section', array( $this, 'prevent_empty_field' ) );
29  }
30 
31  /**
32  * Prevent Sections from being hidden when "Hide Empty Fields" is checked in View settings
33  *
34  * @since 1.15.1
35  *
36  * @param string $output Existing section field output
37  *
38  * @return string If output was empty, return an empty HTML comment tag. Otherwise, return output.
39  */
40  function prevent_empty_field( $output = '' ) {
41  return empty( $output ) ? '<!-- -->' : $output;
42  }
43 
44  public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
45 
46  unset ( $field_options['search_filter'], $field_options['show_as_link'] );
47 
48  // Set the default CSS class to gv-section, which applies a border and top/bottom margin
49  $field_options['custom_class']['value'] = 'gv-section';
50 
51  return $field_options;
52  }
53 
54 }
55 
Modify field settings by extending this class.
Add custom options for HTML field.
prevent_empty_field( $output='')
Prevent Sections from being hidden when "Hide Empty Fields" is checked in View settings.
if(empty( $created_by)) $form_id
field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed
Definition: time.php:22