PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.29
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.29
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 / FrmFieldRadio.php

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

137 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 FrmFieldRadio extends FrmFieldType {
10
11 /**
12 * @var string
13 *
14 * @since 3.0
15 */
16 protected $type = 'radio';
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 * @var bool
36 */
37 protected $array_allowed = true;
38
39 /**
40 * @return string
41 */
42 protected function input_html() {
43 return $this->multiple_input_html();
44 }
45
46 protected function include_form_builder_file() {
47 return $this->include_front_form_file();
48 }
49
50 /**
51 * @return bool[]
52 */
53 protected function field_settings_for_type() {
54 return array(
55 'invalid' => true,
56 );
57 }
58
59 /**
60 * Get the type of field being displayed.
61 *
62 * @since 4.02.01
63 *
64 * @param array|object $field
65 *
66 * @return array
67 */
68 public function displayed_field_type( $field ) {
69 return array(
70 $this->type => true,
71 );
72 }
73
74 /**
75 * @return array
76 */
77 protected function extra_field_opts() {
78 $form_id = $this->get_field_column( 'form_id' );
79
80 return array(
81 'align' => FrmStylesController::get_style_val( 'radio_align', $form_id ? $form_id : 'default' ),
82 );
83 }
84
85 /**
86 * @return string[]
87 */
88 protected function new_field_settings() {
89 return array(
90 'options' => serialize(
91 array(
92 __( 'Option 1', 'formidable' ),
93 __( 'Option 2', 'formidable' ),
94 )
95 ),
96 );
97 }
98
99 /**
100 * @since 4.06
101 *
102 * @param array $args
103 *
104 * @return void
105 */
106 protected function show_priority_field_choices( $args = array() ) {
107 include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/radio-images.php';
108 }
109
110 /**
111 * @return string
112 */
113 protected function include_front_form_file() {
114 return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/radio-field.php';
115 }
116
117 /**
118 * @return bool
119 */
120 protected function show_readonly_hidden() {
121 return true;
122 }
123
124 /**
125 * Unset aria-invalid for radio buttons because it's not valid for radio buttons.
126 * Instead aria-invalid is added to the radiogroup parent element.
127 *
128 * @since 6.25
129 *
130 * @param array $shortcode_atts
131 * @param array $args
132 */
133 public function set_aria_invalid_error( &$shortcode_atts, $args ) {
134 unset( $shortcode_atts['aria-invalid'] );
135 }
136 }
137