Completed
Push — develop ( 7f13c6...c06441 )
by Zack
06:21
created

GravityView_Field_Textarea::field_options()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 24
Code Lines 16

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 24
rs 8.9713
cc 2
eloc 16
nc 2
nop 5
1
<?php
2
/**
3
 * @file class-gravityview-field-textarea.php
4
 * @package GravityView
5
 * @subpackage includes\fields
6
 */
7
8
/**
9
 * Add custom options for textarea fields
10
 */
11
class GravityView_Field_Textarea extends GravityView_Field {
12
13
	var $name = 'textarea';
14
15
	var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' );
16
17
	var $_gf_field_class_name = 'GF_Field_Textarea';
18
19
	var $group = 'standard';
20
21
	public function __construct() {
22
		$this->label = esc_html__( 'Paragraph Text', 'gravityview' );
23
		parent::__construct();
24
	}
25
26
	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...
27
28
		if( 'edit' === $context ) {
29
			return $field_options;
30
		}
31
32
		$field_options['trim_words'] = array(
33
			'type' => 'number',
34
			'merge_tags' => false,
35
			'value' => null,
36
			'label' => __( 'Maximum words shown', 'gravityview' ),
37
			'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' ),
38
		);
39
40
        $field_options['make_clickable'] = array(
41
            'type' => 'checkbox',
42
            'merge_tags' => false,
43
            'value' => 0,
44
            'label' => __( 'Convert text URLs to HTML links', 'gravityview' ),
45
            'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
46
        );
47
48
		return $field_options;
49
	}
50
51
}
52
53
new GravityView_Field_Textarea;
54