Completed
Push — develop ( fc0354...e2ac27 )
by Zack
11:27 queued 07:24
created

GravityView_Field_Post_Image   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A field_options() 0 15 2
1
<?php
2
3
/**
4
 * Add custom options for Post Image fields
5
 */
6
class GravityView_Field_Post_Image extends GravityView_Field {
7
8
	var $name = 'post_image';
9
10
	var $_gf_field_class_name = 'GF_Field_Post_Image';
11
12
	var $label = 'Post Image';
13
14
	public function __construct() {
15
		$this->label = __( 'Post Image', 'gravityview' );
16
		parent::__construct();
17
	}
18
19
	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
20
21
		unset ( $field_options['search_filter'] );
22
23
		if( 'edit' === $context ) {
24
			return $field_options;
25
		}
26
27
		$this->add_field_support('link_to_post', $field_options );
28
29
		// @since 1.5.4
30
		$this->add_field_support('dynamic_data', $field_options );
31
32
		return $field_options;
33
	}
34
35
}
36
37
new GravityView_Field_Post_Image;
38