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

FrmFieldSelect::prepare_import_value()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
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