| @@ -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 |
| @@ -767,12 +779,8 @@ | ||
| 767 | 779 | if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) { |
| 768 | 780 | return; |
| 769 | 781 | } |
| 770 | 782 | |
| 771 | - if ( ! empty( $field['autocomplete'] ) ) { | |
| 772 | - unset( $field['shortcodes']['autocomplete'] ); | |
| 773 | - } | |
| 774 | - | |
| 775 | 783 | foreach ( $field['shortcodes'] as $k => $v ) { |
| 776 | 784 | if ( 'opt' === $k ) { |
| 777 | 785 | continue; |
| 778 | 786 | } |
| @@ -878,9 +886,12 @@ | ||
| 878 | 886 | * |
| 879 | 887 | * @deprecated 4.0 Moved to Pro for Other option only. |
| 880 | 888 | */ |
| 881 | 889 | public static function add_option() { |
| 882 | - _deprecated_function( __METHOD__, '4.0', 'FrmProFieldsController::add_other_option' ); | |
| 890 | + _deprecated_function( __METHOD__, '4.0', 'FrmProFormsController::add_other_option' ); | |
| 891 | + if ( is_callable( 'FrmProFormsController::add_other_option' ) ) { | |
| 892 | + FrmProFormsController::add_other_option(); | |
| 893 | + } | |
| 883 | 894 | } |
| 884 | 895 | |
| 885 | 896 | /** |
| 886 | 897 | * @deprecated 4.0 |
| @@ -908,6 +919,22 @@ | ||
| 908 | 919 | * @return array |
| 909 | 920 | */ |
| 910 | 921 | public static function include_single_field( $field_id, $values, $form_id = 0 ) { |
| 911 | 922 | return FrmDeprecated::include_single_field( $field_id, $values, $form_id ); |
| 923 | + } | |
| 924 | + | |
| 925 | + /** | |
| 926 | + * @deprecated 2.3 | |
| 927 | + * @codeCoverageIgnore | |
| 928 | + */ | |
| 929 | + public static function edit_option() { | |
| 930 | + FrmDeprecated::deprecated( __METHOD__, '2.3' ); | |
| 931 | + } | |
| 932 | + | |
| 933 | + /** | |
| 934 | + * @deprecated 2.3 | |
| 935 | + * @codeCoverageIgnore | |
| 936 | + */ | |
| 937 | + public static function delete_option() { | |
| 938 | + FrmDeprecated::deprecated( __METHOD__, '2.3' ); | |
| 912 | 939 | } |
| 913 | 940 | } |