PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.1
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
← All changes | classes/models/fields/FrmFieldCombo.php +10 -45 6.255.1 View file →
@@ -46,10 +46,8 @@
46 46 /**
47 47 * Registers sub fields.
48 48 *
49 49 * @param array $sub_fields Sub fields. Accepts array or array or array of string.
50 - *
51 - * @return void
52 50 */
53 51 protected function register_sub_fields( array $sub_fields ) {
54 52 $defaults = $this->get_default_sub_field();
55 53
@@ -73,24 +71,8 @@
73 71 ),
74 72 $defaults
75 73 );
76 74 }
77 - }//end foreach
78 - }
79 -
80 - /**
81 - * Set the aria-invalid attribute for subfields.
82 - *
83 - * @since 6.16.3
84 - *
85 - * @param array $shortcode_atts
86 - * @param array $args
87 - *
88 - * @return void
89 - */
90 - public function set_aria_invalid_error( &$shortcode_atts, $args ) {
91 - foreach ( $this->get_sub_fields() as $sub_field ) {
92 - $shortcode_atts[ 'aria-invalid-' . $sub_field['name'] ] = isset( $args['errors'][ 'field' . $this->field_id . '-' . $sub_field['name'] ] ) ? 'true' : 'false';
93 75 }
94 76 }
95 77
96 78 /**
@@ -128,10 +110,9 @@
128 110 continue;
129 111 }
130 112
131 113 foreach ( $sub_field['options'] as $option ) {
132 - if ( 'default_value' === $option ) {
133 - // We parse default value from field column.
114 + if ( 'default_value' === $option ) { // We parse default value from field column.
134 115 continue;
135 116 }
136 117
137 118 if ( is_string( $option ) ) {
@@ -149,12 +130,9 @@
149 130 * Include the settings for placeholder, default value, and sub labels for each
150 131 * of the individual field labels.
151 132 *
152 133 * @since 4.0
153 - *
154 134 * @param array $args Includes 'field', 'display'.
155 - *
156 - * @return void
157 135 */
158 136 public function show_after_default( $args ) {
159 137 $field = (array) $args['field'];
160 138 $default_value = $this->get_default_value();
@@ -198,10 +176,9 @@
198 176
199 177 return $default_value;
200 178 }
201 179
202 - // We store default value as JSON string in db.
203 - return json_decode( $default_value, true );
180 + return json_decode( $default_value, true ); // We store default value as JSON string in db.
204 181 }
205 182
206 183 /**
207 184 * Gets labels for built-in options of fields or sub fields.
@@ -224,10 +201,9 @@
224 201 protected function field_settings_for_type() {
225 202 $settings = array(
226 203 'description' => false,
227 204 'default' => false,
228 - // Don't use the regular placeholder option.
229 - 'clear_on_focus' => false,
205 + 'clear_on_focus' => false, // Don't use the regular placeholder option.
230 206 'logic' => true,
231 207 'visibility' => true,
232 208 );
233 209
@@ -237,10 +213,8 @@
237 213 /**
238 214 * Shows field on the form builder.
239 215 *
240 216 * @param string $name Field name.
241 - *
242 - * @return void
243 217 */
244 218 public function show_on_form_builder( $name = '' ) {
245 219 $field = FrmFieldsHelper::setup_edit_vars( $this->field );
246 220
@@ -299,10 +273,8 @@
299 273 * @type array $shortcode_atts Shortcode attributes.
300 274 * @type array $errors Field errors.
301 275 * @type bool $remove_names Remove name attribute or not.
302 276 * }
303 - *
304 - * @return void
305 277 */
306 278 protected function load_field_output( $args ) {
307 279 if ( empty( $args['field'] ) ) {
308 280 return;
@@ -335,10 +307,8 @@
335 307 * @type array $shortcode_atts Shortcode attributes.
336 308 * @type array $errors Field errors.
337 309 * @type bool $remove_names Remove name attribute or not.
338 310 * }
339 - *
340 - * @return void
341 311 */
342 312 protected function process_args_for_field_output( &$args ) {
343 313 $args['field'] = (array) $args['field'];
344 314
@@ -364,10 +334,8 @@
364 334 /**
365 335 * Prints sub field input atts.
366 336 *
367 337 * @param array $args Arguments. Includes `field`, `sub_field`.
368 - *
369 - * @return void
370 338 */
371 339 protected function print_input_atts( $args ) {
372 340 $field = $args['field'];
373 341 $sub_field = $args['sub_field'];
@@ -380,9 +348,9 @@
380 348 }
381 349 }
382 350
383 351 // Add optional class.
384 - $classes = $sub_field['classes'] ?? '';
352 + $classes = isset( $sub_field['classes'] ) ? $sub_field['classes'] : '';
385 353 if ( is_array( $classes ) ) {
386 354 $classes = implode( ' ', $classes );
387 355 }
388 356
@@ -393,14 +361,10 @@
393 361 if ( $classes ) {
394 362 $field['input_class'] = esc_attr( $classes );
395 363 }
396 364
397 - // Fake it to avoid printing frm-val attribute.
398 - $field['default_value'] = '';
365 + $field['default_value'] = ''; // fake it to avoid printing frm-val attribute.
399 366
400 - if ( ! empty( $sub_field['name'] ) ) {
401 - $field['subfield_name'] = $sub_field['name'];
402 - }
403 367 do_action( 'frm_field_input_html', $field );
404 368
405 369 // Print custom attributes.
406 370 if ( ! empty( $sub_field['atts'] ) && is_array( $sub_field['atts'] ) ) {
@@ -416,9 +380,9 @@
416 380 * @param array $args Arguments. Includes `errors`, `value`.
417 381 * @return array Errors array.
418 382 */
419 383 public function validate( $args ) {
420 - $errors = $args['errors'] ?? array();
384 + $errors = isset( $args['errors'] ) ? $args['errors'] : array();
421 385
422 386 if ( ! $this->field->required ) {
423 387 return $errors;
424 388 }
@@ -452,11 +416,11 @@
452 416 * @return array
453 417 */
454 418 public function get_export_headings() {
455 419 $headings = array();
456 - $field_id = $this->field->id ?? $this->field['id'];
457 - $field_name = $this->field->name ?? $this->field['name'];
458 - $field_key = $this->field->field_key ?? $this->field['field_key'];
420 + $field_id = isset( $this->field->id ) ? $this->field->id : $this->field['id'];
421 + $field_name = isset( $this->field->name ) ? $this->field->name : $this->field['name'];
422 + $field_key = isset( $this->field->field_key ) ? $this->field->field_key : $this->field['field_key'];
459 423 $sub_fields = $this->get_processed_sub_fields();
460 424 foreach ( $sub_fields as $name => $sub_field ) {
461 425 $headings[ $field_id . '_' . $name ] = $field_name . ' (' . $field_key . ') - ' . $sub_field['label'];
462 426 }
@@ -464,8 +428,9 @@
464 428 return $headings;
465 429 }
466 430
467 431 /**
432 + *
468 433 * Get a list of all field settings that should be translated
469 434 * on a multilingual site.
470 435 *
471 436 * @since 3.06.01