PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7
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/FrmForm.php +26 -0 6.56.7 View file →
@@ -376,8 +376,9 @@
376 376 }
377 377 }
378 378
379 379 self::prepare_field_update_values( $field, $values, $new_field );
380 + self::maybe_update_max_option( $field, $values, $new_field );
380 381
381 382 FrmField::update( $field_id, $new_field );
382 383
383 384 FrmField::delete_form_transient( $field->form_id );
@@ -384,8 +385,33 @@
384 385 }
385 386 self::clear_form_cache();
386 387
387 388 return $values;
389 + }
390 +
391 + /**
392 + * Resets the 'max' option of a field when changing paragraph field type to other field types like text, email etc.
393 + *
394 + * @since 6.7
395 + *
396 + * @param array $field
397 + * @param array $values
398 + * @param array $new_field
399 + * @return void
400 + */
401 + private static function maybe_update_max_option( $field, $values, &$new_field ) {
402 + if ( $field->type === 'textarea' &&
403 + ! empty( $values['field_options'][ 'type_' . $field->id ] ) &&
404 + in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) {
405 +
406 + $new_field['field_options']['max'] = '';
407 +
408 + /**
409 + * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads.
410 + * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting.
411 + */
412 + $_POST['field_options'][ 'max_' . $field->id ] = '';
413 + }
388 414 }
389 415
390 416 /**
391 417 * @param string $opt