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

GravityView_Field_Textarea   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B field_options() 0 24 2
1
<?php
2
3
/**
4
 * Add custom options for textarea fields
5
 */
6
class GravityView_Field_Textarea extends GravityView_Field {
7
8
	var $name = 'textarea';
9
10
	var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' );
11
12
	var $_gf_field_class_name = 'GF_Field_Textarea';
13
14
	var $label = 'Paragraph Text';
15
16
	public function __construct() {
17
		$this->label = esc_attr__( 'Paragraph Text', 'gravityview' );
18
		parent::__construct();
19
	}
20
21
	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...
22
23
		if( 'edit' === $context ) {
24
			return $field_options;
25
		}
26
27
		$field_options['trim_words'] = array(
28
			'type' => 'number',
29
			'merge_tags' => false,
30
			'value' => null,
31
			'label' => __( 'Maximum words shown', 'gravityview' ),
32
			'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ),
33
		);
34
35
        $field_options['make_clickable'] = array(
36
            'type' => 'checkbox',
37
            'merge_tags' => false,
38
            'value' => 0,
39
            'label' => __( 'Convert text URLs to HTML links', 'gravityview' ),
40
            'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
41
        );
42
43
		return $field_options;
44
	}
45
46
}
47
48
new GravityView_Field_Textarea;
49