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

GravityView_Field_ID::field_options()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 6
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
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