Code Duplication    Length = 28-29 lines in 4 locations

includes/fields/class-gravityview-field-post-category.php 1 location

@@ 6-33 (lines=28) @@
3
/**
4
 * Add custom options for date fields
5
 */
6
class GravityView_Field_Post_Category extends GravityView_Field {
7
8
	var $name = 'post_category';
9
10
	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
11
12
	var $_gf_field_class_name = 'GF_Field_Post_Category';
13
14
	var $label = 'Category';
15
16
	public function __construct() {
17
		$this->label = esc_attr__( 'Category', 'gravityview' );
18
		parent::__construct();
19
	}
20
21
	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
22
23
		if( 'edit' === $context ) {
24
			return $field_options;
25
		}
26
27
		$this->add_field_support('dynamic_data', $field_options );
28
		$this->add_field_support('link_to_term', $field_options );
29
30
		return $field_options;
31
	}
32
33
}
34
35
new GravityView_Field_Post_Category;
36

includes/fields/class-gravityview-field-post-content.php 1 location

@@ 6-34 (lines=29) @@
3
/**
4
 * Add custom options for date fields
5
 */
6
class GravityView_Field_Post_Content extends GravityView_Field {
7
8
	var $name = 'post_content';
9
10
	var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' );
11
12
	var $_gf_field_class_name = 'GF_Field_Post_Content';
13
14
	var $label = 'Body';
15
16
	public function __construct() {
17
		$this->label = esc_attr__( 'Body', 'gravityview' );
18
		parent::__construct();
19
	}
20
21
	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
22
23
		unset( $field_options['show_as_link'] );
24
25
		if( 'edit' === $context ) {
26
			return $field_options;
27
		}
28
29
		$this->add_field_support('dynamic_data', $field_options );
30
31
		return $field_options;
32
	}
33
34
}
35
36
new GravityView_Field_Post_Content;
37

includes/fields/class-gravityview-field-post-tags.php 1 location

@@ 6-33 (lines=28) @@
3
/**
4
 * Add custom options for date fields
5
 */
6
class GravityView_Field_Post_Tags extends GravityView_Field {
7
8
	var $name = 'post_tags';
9
10
	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
11
12
	var $_gf_field_class_name = 'GF_Field_Post_Tags';
13
14
	var $label = 'Tags';
15
16
	public function __construct() {
17
		$this->label = __( 'Tags', 'gravityview' );
18
		parent::__construct();
19
	}
20
21
	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
22
23
		if( 'edit' === $context ) {
24
			return $field_options;
25
		}
26
27
		$this->add_field_support('dynamic_data', $field_options );
28
		$this->add_field_support('link_to_term', $field_options );
29
30
		return $field_options;
31
	}
32
33
}
34
35
new GravityView_Field_Post_Tags;
36

includes/fields/class-gravityview-field-post-title.php 1 location

@@ 6-34 (lines=29) @@
3
/**
4
 * Add custom options for date fields
5
 */
6
class GravityView_Field_Post_Title extends GravityView_Field {
7
8
	var $name = 'post_title';
9
10
	var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' );
11
12
	var $_gf_field_class_name = 'GF_Field_Post_Title';
13
14
	var $label = 'Title';
15
16
	public function __construct() {
17
		$this->label = esc_attr__( 'Title', 'gravityview' );
18
		parent::__construct();
19
	}
20
21
	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
22
23
		if( 'edit' === $context ) {
24
			return $field_options;
25
		}
26
27
		$this->add_field_support('link_to_post', $field_options );
28
29
		$this->add_field_support('dynamic_data', $field_options );
30
31
		return $field_options;
32
	}
33
34
}
35
36
new GravityView_Field_Post_Title;
37