PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.8
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.8
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 +34 -13 6.56.8 View file →
@@ -72,9 +72,9 @@
72 72
73 73 /**
74 74 * Set up and create a new field
75 75 *
76 - * @param string $field_type
76 + * @param string $field_type
77 77 * @param integer $form_id
78 78 *
79 79 * @return array|bool
80 80 */
@@ -80,8 +80,11 @@
80 80 */
81 81 public static function include_new_field( $field_type, $form_id ) {
82 82 $field_values = FrmFieldsHelper::setup_new_vars( $field_type, $form_id );
83 83
84 + // When a new field is added to the form, flag it as draft and hide it from the front-end.
85 + $field_values['field_options']['draft'] = 1;
86 +
84 87 /**
85 88 * @param array $field_values
86 89 */
87 90 $field_values = apply_filters( 'frm_before_field_created', $field_values );
@@ -140,10 +143,10 @@
140 143 /**
141 144 * @since 3.0
142 145 *
143 146 * @param int|array|object $field_object
144 - * @param array $values
145 - * @param int $form_id
147 + * @param array $values
148 + * @param int $form_id
146 149 */
147 150 public static function load_single_field( $field_object, $values, $form_id = 0 ) {
148 151 global $frm_vars;
149 152 $frm_vars['is_admin'] = true;
@@ -206,10 +209,11 @@
206 209 FrmField::destroy( $field_id );
207 210 wp_die();
208 211 }
209 212
210 - /* Field Options */
211 -
213 + /**
214 + * Field Options.
215 + */
212 216 public static function import_options() {
213 217 FrmAppHelper::permission_check( 'frm_edit_forms' );
214 218 check_ajax_referer( 'frm_ajax', 'nonce' );
215 219
@@ -404,9 +408,9 @@
404 408 return $type;
405 409 }
406 410
407 411 /**
408 - * @param array $settings
412 + * @param array $settings
409 413 * @param object $field_info
410 414 *
411 415 * @return array
412 416 */
@@ -617,14 +621,31 @@
617 621 if ( empty( $placeholder ) ) {
618 622 $placeholder = self::get_default_value_from_name( $field );
619 623 }
620 624
625 + $use_placeholder = $placeholder;
626 + $autocomplete = FrmField::get_option( $field, 'autocom' );
627 +
628 + if ( $autocomplete ) {
629 + $use_chosen = ! is_callable( 'FrmProAppHelper::use_chosen_js' ) || FrmProAppHelper::use_chosen_js();
630 + if ( $use_chosen ) {
631 + $use_placeholder = '';
632 + }
633 + }
634 +
621 635 if ( $placeholder !== '' ) {
622 - ?>
623 - <option value="">
624 - <?php echo esc_html( FrmField::get_option( $field, 'autocom' ) ? '' : $placeholder ); ?>
625 - </option>
626 - <?php
636 + $placeholder_attributes = array(
637 + 'class' => 'frm-select-placeholder',
638 + 'value' => '',
639 + 'data-placeholder' => 'true',
640 + );
641 +
642 + if ( $autocomplete && empty( $use_chosen ) ) {
643 + // This is required for Slim Select.
644 + $placeholder_attributes['data-placeholder'] = 'true';
645 + }
646 +
647 + FrmHtmlHelper::echo_dropdown_option( $use_placeholder, false, $placeholder_attributes );
627 648 return true;
628 649 }
629 650
630 651 return false;
@@ -914,11 +935,11 @@
914 935 /**
915 936 * @deprecated 3.0
916 937 * @codeCoverageIgnore
917 938 *
918 - * @param int $field_id
939 + * @param int $field_id
919 940 * @param array $values
920 - * @param int $form_id
941 + * @param int $form_id
921 942 *
922 943 * @return array
923 944 */
924 945 public static function include_single_field( $field_id, $values, $form_id = 0 ) {