Completed
Push — master ( ac7d8e...ec16eb )
by Stephanie
05:53 queued 02:59
created

FrmFieldSelect   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 48
rs 10
c 0
b 0
f 0
wmc 7
lcom 1
cbo 3

6 Methods

Rating   Name   Duplication   Size   Complexity  
A include_form_builder_file() 0 3 1
A field_settings_for_type() 0 5 1
A new_field_settings() 0 8 1
A include_front_form_file() 0 3 1
A show_readonly_hidden() 0 3 1
A prepare_import_value() 0 6 2
1
<?php
2
3
/**
4
 * @since 3.0
5
 */
6
class FrmFieldSelect extends FrmFieldType {
7
8
	/**
9
	 * @var string
10
	 * @since 3.0
11
	 */
12
	protected $type = 'select';
13
14
	/**
15
	 * @var bool
16
	 * @since 3.0
17
	 */
18
	protected $holds_email_values = true;
19
20
	protected function include_form_builder_file() {
21
		return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/dropdown-field.php';
22
	}
23
24
	protected function field_settings_for_type() {
25
		return array(
26
			'size' => true,
27
		);
28
	}
29
30
	protected function new_field_settings() {
31
		return array(
32
			'options' => serialize( array(
33
				'',
34
				__( 'Option 1', 'formidable' ),
35
			) ),
36
		);
37
	}
38
39
	protected function include_front_form_file() {
40
		return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/dropdown-field.php';
41
	}
42
43
	protected function show_readonly_hidden() {
44
		return true;
45
	}
46
47
	protected function prepare_import_value( $value, $atts ) {
48
		if ( FrmField::is_option_true( $this->field, 'multiple' ) ) {
49
			$value = $this->get_multi_opts_for_import( $value );
50
		}
51
		return $value;
52
	}
53
}
54