Completed
Push — master ( d4df12...804b0a )
by Stephanie
02:42
created

FrmFieldSelect::sanitize_value()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 3
rs 10
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 $this->include_front_form_file();
22
	}
23
24
	protected function field_settings_for_type() {
25
		return array(
26
			'clear_on_focus' => true,
27
			'size' => true,
28
		);
29
	}
30
31
	protected function new_field_settings() {
32
		return array(
33
			'options' => serialize(
34
				array(
35
					'',
36
					__( 'Option 1', 'formidable' ),
37
				)
38
			),
39
		);
40
	}
41
42
	/**
43
	 * Get the type of field being displayed.
44
	 *
45
	 * @since 4.02.01
46
	 * @return array
47
	 */
48
	public function displayed_field_type( $field ) {
49
		return array(
50
			$this->type => true,
51
		);
52
	}
53
54
	/**
55
	 * @since 4.0
56
	 * @param array $args - Includes 'field', 'display', and 'values'
57
	 */
58
	public function show_extra_field_choices( $args ) {
59
		$this->auto_width_setting( $args );
60
	}
61
62
	protected function include_front_form_file() {
63
		return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/dropdown-field.php';
64
	}
65
66
	protected function show_readonly_hidden() {
67
		return true;
68
	}
69
70
	protected function prepare_import_value( $value, $atts ) {
71
		if ( FrmField::is_option_true( $this->field, 'multiple' ) ) {
72
			$value = $this->get_multi_opts_for_import( $value );
73
		}
74
75
		return $value;
76
	}
77
}
78