PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0.14
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0.14
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/controllers/FrmFieldsController.php +41 -23 6.4.25.0.14 View file →
@@ -569,18 +569,21 @@
569 569 }
570 570 }
571 571
572 572 /**
573 - * Prepares field placeholder.
574 - *
575 - * @since 5.4 This doesn't call `FrmFieldsController::get_default_value_from_name()` anymore.
576 - *
577 - * @param array $field Field array.
573 + * @param array $field
578 574 * @return string
579 575 */
580 576 private static function prepare_placeholder( $field ) {
581 - $placeholder = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
577 + $placeholder = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
578 + $placeholder_is_blank = empty( $placeholder ) && '0' !== $placeholder;
579 + $is_placeholder_field = FrmFieldsHelper::is_placeholder_field_type( $field['type'] );
580 + $is_combo_field = in_array( $field['type'], array( 'address', 'credit_card' ), true );
582 581
582 + if ( $placeholder_is_blank && $is_placeholder_field && ! $is_combo_field ) {
583 + $placeholder = self::get_default_value_from_name( $field );
584 + }
585 +
583 586 return $placeholder;
584 587 }
585 588
586 589 /**
@@ -587,9 +590,8 @@
587 590 * If the label position is "inside",
588 591 * get the label to use as the placeholder
589 592 *
590 593 * @since 2.05
591 - * @since 5.4 Remove the logic code for "inside" label position.
592 594 *
593 595 * @param array $field
594 596 *
595 597 * @return string
@@ -594,9 +596,19 @@
594 596 *
595 597 * @return string
596 598 */
597 599 public static function get_default_value_from_name( $field ) {
598 - return '';
600 + $position = FrmField::get_option( $field, 'label' );
601 + if ( $position == 'inside' ) {
602 + $default_value = $field['name'];
603 + if ( FrmField::is_required( $field ) ) {
604 + $default_value .= ' ' . $field['required_indicator'];
605 + }
606 + } else {
607 + $default_value = '';
608 + }
609 +
610 + return $default_value;
599 611 }
600 612
601 613 /**
602 614 * Maybe add a blank placeholder option before any options
@@ -730,11 +742,9 @@
730 742
731 743 $error_body = substr( $custom_html, $start + 10, $end - $start - 10 );
732 744 $default_html = array(
733 745 '<div class="frm_error" id="frm_error_field_[key]">[error]</div>',
734 - '<div class="frm_error" role="alert" id="frm_error_field_[key]">[error]</div>',
735 746 '<div class="frm_error">[error]</div>',
736 - '<div class="frm_error" role="alert">[error]</div>',
737 747 );
738 748
739 749 if ( in_array( $error_body, $default_html, true ) ) {
740 750 return false;
@@ -752,16 +762,9 @@
752 762 * @param array $field
753 763 * @param array $add_html
754 764 */
755 765 private static function maybe_add_html_required( $field, array &$add_html ) {
756 - $excluded_field_types =
757 - FrmField::is_radio( $field ) ||
758 - FrmField::is_checkbox( $field ) ||
759 - FrmField::is_field_type( $field, 'file' ) ||
760 - FrmField::is_field_type( $field, 'nps' ) ||
761 - FrmField::is_field_type( $field, 'scale' );
762 -
763 - if ( $excluded_field_types ) {
766 + if ( in_array( $field['type'], array( 'file', 'data', 'lookup' ), true ) ) {
764 767 return;
765 768 }
766 769
767 770 $include_html = FrmAppHelper::meets_min_pro_version( '3.06.01' );
@@ -774,12 +777,8 @@
774 777 if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) {
775 778 return;
776 779 }
777 780
778 - if ( ! empty( $field['autocomplete'] ) ) {
779 - unset( $field['shortcodes']['autocomplete'] );
780 - }
781 -
782 781 foreach ( $field['shortcodes'] as $k => $v ) {
783 782 if ( 'opt' === $k ) {
784 783 continue;
785 784 }
@@ -885,9 +884,12 @@
885 884 *
886 885 * @deprecated 4.0 Moved to Pro for Other option only.
887 886 */
888 887 public static function add_option() {
889 - _deprecated_function( __METHOD__, '4.0', 'FrmProFieldsController::add_other_option' );
888 + _deprecated_function( __METHOD__, '4.0', 'FrmProFormsController::add_other_option' );
889 + if ( is_callable( 'FrmProFormsController::add_other_option' ) ) {
890 + FrmProFormsController::add_other_option();
891 + }
890 892 }
891 893
892 894 /**
893 895 * @deprecated 4.0
@@ -915,6 +917,22 @@
915 917 * @return array
916 918 */
917 919 public static function include_single_field( $field_id, $values, $form_id = 0 ) {
918 920 return FrmDeprecated::include_single_field( $field_id, $values, $form_id );
921 + }
922 +
923 + /**
924 + * @deprecated 2.3
925 + * @codeCoverageIgnore
926 + */
927 + public static function edit_option() {
928 + FrmDeprecated::deprecated( __METHOD__, '2.3' );
929 + }
930 +
931 + /**
932 + * @deprecated 2.3
933 + * @codeCoverageIgnore
934 + */
935 + public static function delete_option() {
936 + FrmDeprecated::deprecated( __METHOD__, '2.3' );
919 937 }
920 938 }