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 +40 -15 6.35.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;
@@ -767,12 +777,8 @@
767 777 if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) {
768 778 return;
769 779 }
770 780
771 - if ( ! empty( $field['autocomplete'] ) ) {
772 - unset( $field['shortcodes']['autocomplete'] );
773 - }
774 -
775 781 foreach ( $field['shortcodes'] as $k => $v ) {
776 782 if ( 'opt' === $k ) {
777 783 continue;
778 784 }
@@ -878,9 +884,12 @@
878 884 *
879 885 * @deprecated 4.0 Moved to Pro for Other option only.
880 886 */
881 887 public static function add_option() {
882 - _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 + }
883 892 }
884 893
885 894 /**
886 895 * @deprecated 4.0
@@ -908,6 +917,22 @@
908 917 * @return array
909 918 */
910 919 public static function include_single_field( $field_id, $values, $form_id = 0 ) {
911 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' );
912 937 }
913 938 }