Completed
Push — develop ( e2ac27...b5f4d0 )
by Zack
04:24
created

GravityView_Field_Created_By   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A field_options() 0 20 2
1
<?php
2
3
class GravityView_Field_Created_By extends GravityView_Field {
4
5
	var $name = 'created_by';
6
7
	var $search_operators = array( 'is', 'isnot' );
8
9
	var $group = 'meta';
10
11
	public function __construct() {
12
		$this->label = esc_attr__( 'Created By', 'gravityview' );
0 ignored issues
show
Bug introduced by
The property label cannot be accessed from this context as it is declared private in class GravityView_Field.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
13
		parent::__construct();
14
	}
15
16
	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...
17
18
		if( 'edit' === $context ) {
19
			return $field_options;
20
		}
21
22
		$field_options['name_display'] = array(
23
			'type' => 'select',
24
			'label' => __( 'User Format', 'gravityview' ),
25
			'desc' => __( 'How should the User information be displayed?', 'gravityview'),
26
			'choices' => array(
27
				'display_name' => __('Display Name (Example: "Ellen Ripley")', 'gravityview'),
28
				'user_login' => __('Username (Example: "nostromo")', 'gravityview'),
29
				'ID' => __('User ID # (Example: 426)', 'gravityview'),
30
			),
31
			'value' => 'display_name'
32
		);
33
34
		return $field_options;
35
	}
36
37
}
38
39
new GravityView_Field_Created_By;
40