PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.28
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.28
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / classes / models / fields / FrmFieldCheckbox.php

FrmFieldCheckbox.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.28, at classes/models/fields/FrmFieldCheckbox.php

136 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 /**
7 * @since 3.0
8 */
9 class FrmFieldCheckbox extends FrmFieldType {
10
11 /**
12 * @var string
13 *
14 * @since 3.0
15 */
16 protected $type = 'checkbox';
17
18 /**
19 * @var bool
20 *
21 * @since 3.0
22 */
23 protected $holds_email_values = true;
24
25 /**
26 * Does the html for this field label need to include "for"?
27 *
28 * @var bool
29 *
30 * @since 3.06.01
31 */
32 protected $has_for_label = false;
33
34 /**
35 * @return string
36 */
37 protected function input_html() {
38 return $this->multiple_input_html();
39 }
40
41 protected function include_form_builder_file() {
42 return $this->include_front_form_file();
43 }
44
45 /**
46 * @return bool[]
47 */
48 protected function field_settings_for_type() {
49 return array(
50 'invalid' => true,
51 );
52 }
53
54 /**
55 * @return string[]
56 */
57 protected function new_field_settings() {
58 return array(
59 'options' => serialize(
60 array(
61 __( 'Option 1', 'formidable' ),
62 __( 'Option 2', 'formidable' ),
63 )
64 ),
65 );
66 }
67
68 /**
69 * Get the type of field being displayed.
70 *
71 * @since 4.02.01
72 *
73 * @param array|object $field
74 *
75 * @return array
76 */
77 public function displayed_field_type( $field ) {
78 return array(
79 $this->type => true,
80 );
81 }
82
83 /**
84 * @return array
85 */
86 protected function extra_field_opts() {
87 $form_id = $this->get_field_column( 'form_id' );
88
89 return array(
90 'align' => FrmStylesController::get_style_val( 'check_align', $form_id ? $form_id : 'default' ),
91 );
92 }
93
94 /**
95 * @since 4.06
96 *
97 * @param array $args
98 *
99 * @return void
100 */
101 protected function show_priority_field_choices( $args = array() ) {
102 include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/radio-images.php';
103 }
104
105 /**
106 * @return string
107 */
108 protected function include_front_form_file() {
109 return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/checkbox-field.php';
110 }
111
112 /**
113 * @return bool
114 */
115 protected function show_readonly_hidden() {
116 return true;
117 }
118
119 protected function prepare_import_value( $value, $atts ) {
120 return $this->get_multi_opts_for_import( $value );
121 }
122
123 /**
124 * Unset aria-invalid for checkboxes because it's not valid for checkboxes.
125 * Instead aria-invalid is added to the checkbox group parent element.
126 *
127 * @since 6.25
128 *
129 * @param array $shortcode_atts
130 * @param array $args
131 */
132 public function set_aria_invalid_error( &$shortcode_atts, $args ) {
133 unset( $shortcode_atts['aria-invalid'] );
134 }
135 }
136