GravityView  1.19.4
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  public function __construct() {
22  $this->label = esc_html__( 'Section', 'gravityview' );
23 
24  parent::__construct();
25 
26  add_filter( 'gravityview_field_entry_value_section', array( $this, 'prevent_empty_field' ) );
27  }
28 
29  /**
30  * Prevent Sections from being hidden when "Hide Empty Fields" is checked in View settings
31  *
32  * @since 1.15.1
33  *
34  * @param string $output Existing section field output
35  *
36  * @return string If output was empty, return an empty HTML comment tag. Otherwise, return output.
37  */
38  function prevent_empty_field( $output = '' ) {
39  return empty( $output ) ? '<!-- -->' : $output;
40  }
41 
42  function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
43 
44  unset ( $field_options['search_filter'], $field_options['show_as_link'] );
45 
46  // Set the default CSS class to gv-section, which applies a border and top/bottom margin
47  $field_options['custom_class']['value'] = 'gv-section';
48 
49  return $field_options;
50  }
51 
52 }
53 
Modify field settings by extending this class.
field_options($field_options, $template_id, $field_id, $context, $input_type)
Add custom options for HTML field.
prevent_empty_field($output= '')
Prevent Sections from being hidden when "Hide Empty Fields" is checked in View settings.
$field_id
Definition: time.php:17