Completed
Pull Request — develop (#1572)
by Zack
19:45
created

GravityView_Field_ID   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A field_options() 0 12 3
1
<?php
2
/**
3
 * @file class-gravityview-field-id.php
4
 * @package GravityView
5
 * @subpackage includes\fields
6
 * @since 2.10
7
 */
8
9
class GravityView_Field_ID extends GravityView_Field {
10
11
	var $name = 'id';
12
13
	var $is_searchable = true;
14
15
	var $search_operators = array( 'is', 'isnot', 'greater_than', 'less_than', 'in', 'not_in' );
16
17
	var $group = 'meta';
18
19
	var $icon = 'dashicons-code-standards';
20
21
	var $is_numeric = true;
22
23
	public function __construct() {
24
		$this->label = esc_html__( 'Entry ID', 'gravityview' );
25
	    $this->description = __('The unique ID of the entry.', 'gravityview');
26
		parent::__construct();
27
	}
28
29
	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
30
31
		if( 'edit' === $context ) {
32
			return $field_options;
33
		}
34
35
		if ( 'single' === $context ) {
36
			unset( $field_options['new_window'] );
37
		}
38
39
		return $field_options;
40
	}
41
}
42
43
new GravityView_Field_ID;
44