Code Duplication    Length = 54-58 lines in 2 locations

classes/models/fields/FrmFieldCheckbox.php 1 location

@@ 6-63 (lines=58) @@
3
/**
4
 * @since 3.0
5
 */
6
class FrmFieldCheckbox extends FrmFieldType {
7
8
	/**
9
	 * @var string
10
	 * @since 3.0
11
	 */
12
	protected $type = 'checkbox';
13
14
	/**
15
	 * @var bool
16
	 * @since 3.0
17
	 */
18
	protected $holds_email_values = true;
19
20
	protected $is_tall = true;
21
22
	protected function input_html() {
23
		return $this->multiple_input_html();
24
	}
25
26
	protected function include_form_builder_file() {
27
		return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-multiple.php';
28
	}
29
30
	protected function field_settings_for_type() {
31
		return array(
32
			'default_blank' => false,
33
		);
34
	}
35
36
	protected function new_field_settings() {
37
		return array(
38
			'options' => serialize( array(
39
				__( 'Option 1', 'formidable' ),
40
				__( 'Option 2', 'formidable' ),
41
			) ),
42
		);
43
	}
44
45
	protected function extra_field_opts() {
46
		$form_id = $this->get_field_column('form_id');
47
		return array(
48
			'align' => FrmStylesController::get_style_val( 'check_align', ( empty( $form_id ) ? 'default' : $form_id ) ),
49
		);
50
	}
51
52
	protected function include_front_form_file() {
53
		return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/checkbox-field.php';
54
	}
55
56
	protected function show_readonly_hidden() {
57
		return true;
58
	}
59
60
	protected function prepare_import_value( $value, $atts ) {
61
		return $this->get_multi_opts_for_import( $value );
62
	}
63
}
64

classes/models/fields/FrmFieldRadio.php 1 location

@@ 6-59 (lines=54) @@
3
/**
4
 * @since 3.0
5
 */
6
class FrmFieldRadio extends FrmFieldType {
7
8
	/**
9
	 * @var string
10
	 * @since 3.0
11
	 */
12
	protected $type = 'radio';
13
14
	/**
15
	 * @var bool
16
	 * @since 3.0
17
	 */
18
	protected $holds_email_values = true;
19
20
	protected $is_tall = true;
21
22
	protected function input_html() {
23
		return $this->multiple_input_html();
24
	}
25
26
	protected function include_form_builder_file() {
27
		return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-multiple.php';
28
	}
29
30
	protected function field_settings_for_type() {
31
		return array(
32
			'default_blank' => false,
33
		);
34
	}
35
36
	protected function extra_field_opts() {
37
		$form_id = $this->get_field_column('form_id');
38
		return array(
39
			'align' => FrmStylesController::get_style_val( 'radio_align', ( empty( $form_id ) ? 'default' : $form_id ) ),
40
		);
41
	}
42
43
	protected function new_field_settings() {
44
		return array(
45
			'options' => serialize( array(
46
				__( 'Option 1', 'formidable' ),
47
				__( 'Option 2', 'formidable' ),
48
			) ),
49
		);
50
	}
51
52
	protected function include_front_form_file() {
53
		return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/radio-field.php';
54
	}
55
56
	protected function show_readonly_hidden() {
57
		return true;
58
	}
59
}
60