PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
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/views/frm-fields/back-end/settings.php +313 -113 6.5.2 → trunk View file →
@@ -1,5 +1,27 @@
1 1 <?php
2 +/**
3 + * Field settings panel in the form builder.
4 + *
5 + * @package Formidable
6 + *
7 + * @var array $field Field data.
8 + * @var array $display Display options for each setting section.
9 + * @var array $values Form values associated with the field.
10 + * @var FrmFieldType $field_obj Field type handler.
11 + * @var string $type_name Human-readable field type name.
12 + * @var array $field_types Available field types this field can switch to.
13 + * @var array $disabled_fields Field types that are disabled in the type dropdown.
14 + * @var array $default_value_types Default value types available for this field.
15 + * @var array $unique_values_label_atts Label attributes for the Unique checkbox.
16 + * @var array $read_only_label_atts Label attributes for the Read Only checkbox.
17 + * @var bool|null $show_upsell_for_unique_value Whether to show upsell for Unique.
18 + * @var bool|null $show_upsell_for_read_only Whether to show upsell for Read Only.
19 + * @var bool|null $show_upsell_for_before_after_contents Whether to show upsell for before/after contents.
20 + * @var bool|null $show_upsell_for_autocomplete Whether to show upsell for autocomplete.
21 + * @var bool|null $show_upsell_for_visibility Whether to show upsell for visibility.
22 + */
23 +
2 24 if ( ! defined( 'ABSPATH' ) ) {
3 25 die( 'You are not allowed to call this page directly.' );
4 26 }
5 27 ?>
@@ -4,13 +26,10 @@
4 26 }
5 27 ?>
6 28 <div class="frm-single-settings frm_hidden frm-fields frm-type-<?php echo esc_attr( $field['type'] ); ?>" id="frm-single-settings-<?php echo esc_attr( $field['id'] ); ?>" data-fid="<?php echo esc_attr( $field['id'] ); ?>">
7 29 <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr( $field['id'] ); ?>" />
8 - <input type="hidden" name="field_options[field_order_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['field_order'] ); ?>"/>
30 + <input type="hidden" name="field_options[field_order_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['field_order'] ); ?>" />
9 31
10 - <div class="frm-sub-label alignright">
11 - (ID <?php echo esc_html( $field['id'] ); ?>)
12 - </div>
13 32 <h3 aria-expanded="true">
14 33 <?php
15 34 printf(
16 35 /* translators: %s: Field type */
@@ -17,8 +36,9 @@
17 36 esc_html__( '%s Field', 'formidable' ),
18 37 esc_html( $type_name )
19 38 );
20 39 ?>
40 + <span class="frm-sub-label frm-text-sm frm-text-grey-400">(ID <?php echo esc_html( $field['id'] ); ?>)</span>
21 41 </h3>
22 42
23 43 <div class="frm_grid_container frm-collapse-me" role="group">
24 44 <?php
@@ -24,29 +44,30 @@
24 44 <?php
25 45 if ( $field['type'] === 'captcha' && ! FrmFieldCaptcha::should_show_captcha() ) {
26 46 ?>
27 47 <div class="frm_warning_style frm-with-icon">
28 - <?php FrmAppHelper::icon_by_class( 'frm_icon_font frm_alert_icon', array( 'style' => 'width:24px' ) ); ?>
48 + <?php FrmAppHelper::icon_by_class( 'frmfont frm_alert_icon', array( 'style' => 'width:24px' ) ); ?>
29 49 <span>
30 50 <?php
31 51 /* translators: %1$s: Link HTML, %2$s: End link */
32 - printf( esc_html__( 'Captchas will not be used until the Site and Secret Keys are %1$sset up%2$s.', 'formidable' ), '<a href="?page=formidable-settings" target="_blank">', '</a>' );
52 + printf( esc_html__( 'Captchas will not be used until the Site and Secret Keys are %1$sset up%2$s.', 'formidable' ), '<a href="?page=formidable-settings&t=captcha_settings" target="_blank">', '</a>' );
33 53 ?>
34 54 </span>
35 55 </div>
36 56 <?php
37 57 }
58 +
38 59 if ( $field['type'] === 'credit_card' && ! FrmAppHelper::pro_is_installed() ) {
39 - if ( ! FrmStrpLiteConnectHelper::at_least_one_mode_is_setup() ) {
60 + if ( ! FrmStrpLiteConnectHelper::at_least_one_mode_is_setup() && ! FrmSquareLiteConnectHelper::at_least_one_mode_is_setup() && ! FrmPayPalLiteConnectHelper::at_least_one_mode_is_setup() ) {
40 61 FrmStrpLiteAppHelper::not_connected_warning();
41 62 } elseif ( ! FrmTransLiteActionsController::get_actions_for_form( $field['form_id'] ) ) {
42 63 ?>
43 64 <div class="frm_warning_style frm-with-icon">
44 - <?php FrmAppHelper::icon_by_class( 'frm_icon_font frm_alert_icon', array( 'style' => 'width:24px' ) ); ?>
65 + <?php FrmAppHelper::icon_by_class( 'frmfont frm_alert_icon', array( 'style' => 'width:24px' ) ); ?>
45 66 <span>
46 67 <?php
47 68 /* translators: %1$s: Link HTML, %2$s: End link */
48 - printf( esc_html__( 'Credit Cards will not work without %1$sadding a Collect Payment action%2$s.', 'formidable' ), '<a href="?page=formidable&frm_action=settings&id=' . absint( $field['form_id'] ) . '&t=email_settings" target="_blank">', '</a>' );
69 + printf( esc_html__( 'Credit Cards will not work without %1$sadding a Stripe, Square, or PayPal action%2$s.', 'formidable' ), '<a href="?page=formidable&frm_action=settings&id=' . absint( $field['form_id'] ) . '&t=email_settings" target="_blank">', '</a>' );
49 70 ?>
50 71 </span>
51 72 </div>
52 73 <?php
@@ -52,12 +73,44 @@
52 73 <?php
53 74 }
54 75 }
55 76 ?>
77 +
78 + <?php
79 + if ( $field['type'] === FrmFieldGdprHelper::FIELD_TYPE && FrmFieldGdprHelper::hide_gdpr_field() ) {
80 + ?>
81 + <div class="frm_note_style">
82 + <?php FrmAppHelper::icon_by_class( 'frmfont frm_alert_icon', array( 'style' => 'width:24px' ) ); ?>
83 + <span>
84 + <?php
85 + /* translators: %1$s: Link HTML, %2$s: End link */
86 + printf( esc_html__( 'GDPR field is disabled. Please enable it in the Formidable %1$sSettings%2$s.', 'formidable' ), '<a href="?page=formidable-settings" target="_blank">', '</a>' );
87 + ?>
88 + </span>
89 + </div>
90 + <?php
91 + }
92 + ?>
93 +
94 + <?php
95 + /**
96 + * Fires before the field label in the field settings.
97 + *
98 + * @since 6.23
99 + *
100 + * @param array $field The field settings.
101 + * @param array $display The display settings for the field.
102 + * @param array $values The values associated with the field.
103 + */
104 + do_action( 'frm_field_options_before_label', $field, $display, $values );
105 + ?>
56 106 <?php if ( $display['label'] ) { ?>
57 - <p>
107 + <p class="frm-mt-xs">
58 108 <label for="frm_name_<?php echo esc_attr( $field['id'] ); ?>">
59 - <?php echo esc_html( apply_filters( 'frm_builder_field_label', __( 'Field Label', 'formidable' ), $field ) ); ?>
109 + <?php
110 + // skipcq: PHP-W1020
111 + echo esc_html( apply_filters( 'frm_builder_field_label', __( 'Field Label', 'formidable' ), $field ) );
112 + ?>
60 113 </label>
61 114 <input type="text" name="field_options[name_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['name'] ); ?>" id="frm_name_<?php echo esc_attr( $field['id'] ); ?>" data-changeme="field_label_<?php echo esc_attr( $field['id'] ); ?>" />
62 115 </p>
63 116 <?php } else { ?>
@@ -63,66 +116,93 @@
63 116 <?php } else { ?>
64 117 <input type="hidden" name="field_options[name_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['name'] ); ?>" id="frm_name_<?php echo esc_attr( $field['id'] ); ?>" />
65 118 <?php } ?>
66 119
67 - <p class="frm-hide-empty">
120 + <div class="frm-hide-empty frm-inline-flex frm-gap-sm frm-flex-wrap frm-items-center frm-my-xs">
68 121 <?php if ( $display['required'] ) { ?>
69 - <label for="frm_req_field_<?php echo esc_attr( $field['id'] ); ?>" class="frm_inline_label">
70 - <input type="checkbox" id="frm_req_field_<?php echo esc_attr( $field['id'] ); ?>" class="frm_req_field" name="field_options[required_<?php echo esc_attr( $field['id'] ); ?>]" value="1" <?php checked( $field['required'], 1 ); ?> />
71 - <?php esc_html_e( 'Required', 'formidable' ); ?>
72 - </label>
122 + <div class="frm_form_field">
123 + <label for="frm_req_field_<?php echo esc_attr( $field['id'] ); ?>" class="frm-mb-0">
124 + <input type="checkbox" id="frm_req_field_<?php echo esc_attr( $field['id'] ); ?>" class="frm_req_field" name="field_options[required_<?php echo esc_attr( $field['id'] ); ?>]" value="1" <?php echo $display['readonly_required'] ? 'readonly onclick="return false;"' : ''; ?> <?php checked( ! empty( $field['required'] ) || ! empty( $display['readonly_required'] ) ); ?> />
125 + <?php esc_html_e( 'Required', 'formidable' ); ?>
126 + </label>
127 + </div>
73 128 <?php
74 129 }
75 130
76 - if ( $display['unique'] ) {
131 + if ( $display['unique'] || ! empty( $show_upsell_for_unique_value ) ) {
77 132 ?>
78 - <label for="frm_uniq_field_<?php echo esc_attr( $field['id'] ); ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Unique: Do not allow the same response multiple times. For example, if one user enters \'Joe\', then no one else will be allowed to enter the same name.', 'formidable' ); ?>"><input type="checkbox" name="field_options[unique_<?php echo esc_attr( $field['id'] ); ?>]" id="frm_uniq_field_<?php echo esc_attr( $field['id'] ); ?>" value="1" <?php checked( $field['unique'], 1 ); ?> class="frm_mark_unique" />
79 - <?php esc_html_e( 'Unique', 'formidable' ); ?>
80 - </label>
133 + <div class="frm_form_field">
134 + <label <?php FrmAppHelper::array_to_html_params( $unique_values_label_atts, true ); ?>>
135 + <input <?php FrmAppHelper::array_to_html_params( FrmSettingsUpsellHelper::get_unique_element_atts( $field ), true ); ?> />
136 + <?php esc_html_e( 'Unique', 'formidable' ); ?>
137 + </label>
138 + </div>
81 139 <?php
82 140 }
83 141
84 - if ( $display['read_only'] ) {
142 + if ( $display['read_only'] || ! empty( $show_upsell_for_read_only ) ) {
85 143 ?>
86 - <label for="frm_read_only_field_<?php echo esc_attr( $field['id'] ); ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Read Only: Show this field but do not allow the field value to be edited from the front-end.', 'formidable' ); ?>" >
87 - <input type="checkbox" id="frm_read_only_field_<?php echo esc_attr( $field['id'] ); ?>" name="field_options[read_only_<?php echo esc_attr( $field['id'] ); ?>]" value="1" <?php checked( $field['read_only'], 1 ); ?>/>
88 - <?php esc_html_e( 'Read Only', 'formidable' ); ?>
89 - </label>
144 + <div class="frm_form_field">
145 + <label <?php FrmAppHelper::array_to_html_params( $read_only_label_atts, true ); ?>>
146 + <input <?php FrmAppHelper::array_to_html_params( FrmSettingsUpsellHelper::get_read_only_element_atts( $field ), true ); ?> />
147 + <?php esc_html_e( 'Read Only', 'formidable' ); ?>
148 + </label>
149 + </div>
90 150 <?php
91 151 }
92 -
93 152 do_action( 'frm_field_options_form_top', $field, $display, $values );
94 153 ?>
95 - </p>
154 + </div>
96 155
97 156 <?php
98 157 if ( $display['range'] ) {
99 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/number-range.php' );
158 + include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/number-range.php';
100 159 }
101 160
102 161 $field_obj->show_primary_options( compact( 'field', 'display', 'values' ) );
103 162
163 + if ( $display['format'] ) {
164 + include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/format-dropdown.php';
165 + FrmFieldsController::show_format_option( $field, true );
166 + }
104 167 ?>
105 168
106 169 <?php if ( $display['css'] ) { ?>
107 170 <p class="frm-has-modal">
108 - <label for="frm_classes_<?php echo esc_attr( $field['id'] ); ?>" class="frm_help" title="<?php esc_attr_e( 'Add a CSS class to the field container. Use our predefined classes to align multiple fields in single row.', 'formidable' ); ?>">
109 - <?php esc_html_e( 'CSS Layout Classes', 'formidable' ); ?>
171 + <label class="frm-h-stack-xs" for="frm_classes_<?php echo esc_attr( $field['id'] ); ?>">
172 + <span><?php esc_html_e( 'CSS Layout Classes', 'formidable' ); ?></span>
173 + <?php FrmAppHelper::tooltip_icon( __( 'Add a CSS class to the field container. Use our predefined classes to align multiple fields in single row.', 'formidable' ), array( 'class' => 'frm-flex' ) ); ?>
110 174 </label>
111 - <span class="frm-with-right-icon">
175 + <span class="frm-with-right-icon frm-block">
112 176 <?php
177 + $css_layout_classes_attrs = array(
178 + 'type' => 'text',
179 + 'name' => 'field_options[classes_' . $field['id'] . ']',
180 + 'value' => $field['classes'],
181 + 'class' => 'frm_classes frm-token-input-field',
182 + 'id' => 'frm_classes_' . $field['id'],
183 + 'data-changeme' => 'frm_field_id_' . $field['id'],
184 + 'data-changeatt' => 'class',
185 + 'data-sep' => ' ',
186 + 'data-shortcode' => '0',
187 + );
188 + ?>
189 + <input <?php FrmAppHelper::array_to_html_params( $css_layout_classes_attrs, true ); ?> />
190 + <?php
113 191 FrmAppHelper::icon_by_class(
114 - 'frm_icon_font frm_more_horiz_solid_icon frm-show-inline-modal',
192 + 'frmfont frm_more_horiz_solid_icon frm-show-inline-modal frm-input-icon',
115 193 array(
116 194 'data-open' => 'frm-layout-classes-box',
117 195 'title' => esc_attr__( 'Toggle Options', 'formidable' ),
196 + 'tabindex' => '0',
118 197 )
119 198 );
120 199 ?>
121 - <input type="text" name="field_options[classes_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['classes'] ); ?>" class="frm_classes" id="frm_classes_<?php echo esc_attr( $field['id'] ); ?>" data-changeme="frm_field_id_<?php echo esc_attr( $field['id'] ); ?>" data-changeatt="class" data-sep=" " data-shortcode="0" />
122 200 </span>
123 201 </p>
124 - <?php } ?>
202 + <?php
203 + }//end if
204 + ?>
125 205 </div>
126 206
127 207 <?php
128 208
@@ -136,56 +216,110 @@
136 216 * Fires after printing the primary options section of field.
137 217 *
138 218 * @since 5.0.04 Added `$display` and `$values`.
139 219 *
140 - * @param array $field Field data.
141 - * @param FrmFieldType $field_obj Field type object.
142 - * @param array $display Display data.
143 - * @param array $values Field values.
220 + * @param array $field Field data.
221 + * @param array{field_obj:FrmFieldType, display:array, values:array} $data
144 222 */
145 223 do_action( 'frm_before_field_options', $field, compact( 'field_obj', 'display', 'values' ) );
146 224
147 225 ?>
148 - <h3 class="frm-collapsed" aria-expanded="false" tabindex="0" role="button" aria-label="<?php esc_html_e( 'Collapsible Advanced Settings', 'formidable' ); ?>" aria-controls="collapsible-section">
226 + <h3 class="frm-collapsed" aria-expanded="false" tabindex="0" role="button" aria-label="<?php esc_attr_e( 'Collapsible Advanced Settings', 'formidable' ); ?>" aria-controls="collapsible-section">
149 227 <?php esc_html_e( 'Advanced', 'formidable' ); ?>
150 - <?php FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) ); ?>
228 + <?php FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown8_icon', array( 'aria-hidden' => 'true' ) ); ?>
151 229 </h3>
230 +
152 231 <div class="frm_grid_container frm-collapse-me" role="group">
153 -
154 232 <?php if ( $display['default'] ) { ?>
155 - <div class="frm-has-modal">
156 - <?php if ( count( $default_value_types ) > 1 ) { ?>
157 - <span class="frm-default-switcher">
158 - <?php foreach ( $default_value_types as $def_name => $link ) { ?>
159 - <a href="#" title="<?php echo esc_attr( $link['title'] ); ?>" class="<?php echo esc_attr( $link['class'] ); ?>" data-toggleclass="frm_hidden frm-open"
160 - <?php foreach ( $link['data'] as $data_key => $data_value ) { ?>
161 - data-<?php echo esc_attr( $data_key ); ?>="<?php echo esc_attr( $data_value . ( substr( $data_value, -1 ) === '-' ? $field['id'] : '' ) ); ?>"
162 - <?php } ?>
163 - <?php if ( isset( $link['data']['frmshow'] ) ) { ?>
164 - data-frmhide=".frm-inline-modal,.default-value-section-<?php echo esc_attr( $field['id'] ); ?>"
165 - <?php } ?>
166 - >
167 - <?php FrmAppHelper::icon_by_class( $link['icon'] ); ?>
168 - </a>
169 - <?php } ?>
170 - </span>
171 - <?php } ?>
233 + <div class="frm-has-modal frm-flex-col">
172 234 <?php $field_obj->show_default_value_setting( $field, $field_obj, $default_value_types, $display ); ?>
173 - <?php do_action( 'frm_default_value_setting', compact( 'field', 'display', 'default_value_types' ) ); ?>
235 +
236 + <div class="frm-hide-empty frm-flex-col frm-gap-sm frm-mb-sm frm-toggle-group">
237 + <?php
238 + foreach ( $default_value_types as $type => $default_value_type ) {
239 + if ( 'default_value' === $type ) {
240 + continue;
241 + }
242 +
243 + // Backwards compatibility "@since 6.24".
244 + if ( FrmAppHelper::pro_is_connected() && ! is_callable( array( 'FrmProHtmlHelper', 'echo_radio_group' ) ) ) {
245 + switch ( $type ) {
246 + case 'calc':
247 + $default_value_type['data'] = array(
248 + 'show' => '#calc-for-{id}',
249 + 'disable' => '#default-value-for-{id}',
250 + );
251 + break;
252 + case 'get_values_field':
253 + $default_value_type['class'] = '';
254 + $default_value_type['data'] = array(
255 + 'show' => '.frm-lookup-box-{id}',
256 + 'disable' => '#default-value-for-{id}',
257 + );
258 + break;
259 + }
260 + }
261 +
262 + $toggle_args = array(
263 + 'echo' => true,
264 + 'show_labels' => true,
265 + 'on_label' => $default_value_type['title'],
266 + 'checked' => isset( $default_value_type['current'] ),
267 + 'input_html' => array(
268 + 'data-group-name' => 'default-value',
269 + 'class' => $default_value_type['class'],
270 + ),
271 + );
272 +
273 + foreach ( $default_value_type['data'] as $data_key => $data_value ) {
274 + $toggle_args['input_html'][ 'data-' . $data_key ] = $data_value . ( str_ends_with( $data_value, '-' ) ? $field['id'] : '' );
275 + }
276 +
277 + ?>
278 + <div class="frm-flex frm-gap-xs frm-items-center">
279 + <?php
280 + FrmHtmlHelper::toggle(
281 + 'frm-default-type-' . $type . '-' . $field['id'],
282 + 'default_type_' . $type . '[' . $field['id'] . ']',
283 + $toggle_args
284 + );
285 +
286 + if ( ! empty( $default_value_type['tooltip'] ) ) {
287 + FrmAppHelper::tooltip_icon( $default_value_type['tooltip'], array( 'class' => 'frm-flex' ) );
288 + }
289 + ?>
290 + </div>
291 + <?php
292 + }//end foreach
293 + ?>
294 + </div>
295 +
296 + <?php
297 + /**
298 + * Fires after printing the default value setting.
299 + *
300 + * @param array $field
301 + * @param array $display
302 + * @param array $default_value_types
303 + */
304 + do_action( 'frm_default_value_setting', compact( 'field', 'display', 'default_value_types' ) );
305 + ?>
174 306 </div>
175 - <?php } ?>
307 + <?php
308 + }//end if
176 309
177 - <?php $field_obj->show_after_default( compact( 'field', 'display' ) ); ?>
310 + $field_obj->show_after_default( compact( 'field', 'display' ) );
178 311
179 - <?php if ( $display['clear_on_focus'] ) { ?>
180 - <p>
312 + if ( $display['clear_on_focus'] ) {
313 + ?>
314 + <p class="frm-flex-col">
181 315 <label for="frm_placeholder_<?php echo esc_attr( $field['id'] ); ?>">
182 - <?php esc_html_e( 'Placeholder Text', 'formidable' ); ?>
316 + <?php esc_html_e( 'Placeholder Text', 'formidable' ); ?>
183 317 </label>
184 318 <?php
185 319 if ( $display['type'] === 'textarea' || $display['type'] === 'rte' ) {
186 320 ?>
187 - <textarea name="field_options[placeholder_<?php echo esc_attr( $field['id'] ); ?>]" id="frm_placeholder_<?php echo esc_attr( $field['id'] ); ?>" rows="3" data-changeme="field_<?php echo esc_attr( $field['field_key'] ); ?>" data-changeatt="placeholder"><?php
321 + <textarea name="field_options[placeholder_<?php echo esc_attr( $field['id'] ); ?>]" id="frm_placeholder_<?php echo esc_attr( $field['id'] ); ?>" rows="2" data-changeme="field_<?php echo esc_attr( $field['field_key'] ); ?>" data-changeatt="placeholder"><?php
188 322 echo FrmAppHelper::esc_textarea( $field['placeholder'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
189 323 ?></textarea>
190 324 <?php
191 325 } else {
@@ -194,35 +328,62 @@
194 328 <?php
195 329 }
196 330 ?>
197 331 </p>
198 - <?php } ?>
332 + <?php
333 + }//end if
199 334
200 - <?php
201 335 if ( $display['description'] ) {
202 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-description.php' );
336 + include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-description.php';
203 337 }
204 338
339 + /**
340 + * Fires after displaying the field description in a form settings.
341 + *
342 + * @since 6.19
343 + *
344 + * @param array $args {
345 + * Array containing the field data.
346 + *
347 + * @type array $field The field settings.
348 + * @type array $display The display settings for the field.
349 + * @type array $values The values associated with the field.
350 + * }
351 + */
352 + do_action( 'frm_field_options_after_description', compact( 'field', 'display', 'values' ) );
353 +
205 354 // Field Size
206 - if ( $display['size'] && ! in_array( $field['type'], array( 'select', 'data', 'time' ) ) ) {
355 + if ( $display['size'] && ! in_array( $field['type'], array( 'select', 'data', 'time' ), true ) ) {
207 356 $display_max = $display['max'];
208 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/pixels-wide.php' );
357 + include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/pixels-wide.php';
209 358 }
210 - ?>
211 359
212 - <?php if ( $display['show_image'] ) { ?>
213 - <p>
214 - <label for="frm_show_image_<?php echo esc_attr( $field['id'] ); ?>">
215 - <input type="checkbox" id="frm_show_image_<?php echo esc_attr( $field['id'] ); ?>" name="field_options[show_image_<?php echo esc_attr( $field['id'] ); ?>]" value="1" <?php checked( $field['show_image'], 1 ); ?> />
216 - <?php esc_html_e( 'If this URL points to an image, show to image on the entries listing page.', 'formidable' ); ?>
360 + if ( ! empty( $show_upsell_for_before_after_contents ) ) {
361 + include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/upsell/before-after-contents.php';
362 + }
363 +
364 + if ( ! empty( $show_upsell_for_autocomplete ) ) {
365 + include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/upsell/autocomplete.php';
366 + }
367 +
368 + if ( ! empty( $show_upsell_for_visibility ) ) {
369 + include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/upsell/visibility.php';
370 + }
371 +
372 + if ( $display['show_image'] ) {
373 + ?>
374 + <p class="frm_form_field">
375 + <label class="frm-force-flex frm-gap-xs" for="frm_show_image_<?php echo esc_attr( $field['id'] ); ?>">
376 + <input class="frm-m-0" type="checkbox" id="frm_show_image_<?php echo esc_attr( $field['id'] ); ?>" name="field_options[show_image_<?php echo esc_attr( $field['id'] ); ?>]" value="1" <?php checked( $field['show_image'], 1 ); ?> />
377 + <span class="-frm-mt-2xs"><?php esc_html_e( 'If this URL points to an image, show to image on the entries listing page.', 'formidable' ); ?></span>
217 378 </label>
218 379 </p>
219 380 <?php } ?>
220 381
221 - <?php if ( $display['captcha_size'] && $frm_settings->re_type !== 'invisible' && $frm_settings->active_captcha === 'recaptcha' ) { ?>
382 + <?php if ( $display['captcha_size'] ) { ?>
222 383 <p class="frm6 frm_first frm_form_field">
223 384 <label for="field_options_captcha_size_<?php echo esc_attr( $field['id'] ); ?>" class="frm_help" title="<?php esc_attr_e( 'Set the size of the captcha field. The compact option is best if your form is in a small area.', 'formidable' ); ?>">
224 - <?php esc_html_e( 'ReCaptcha Type', 'formidable' ); ?>
385 + <?php esc_html_e( 'Captcha Size', 'formidable' ); ?>
225 386 </label>
226 387 <select name="field_options[captcha_size_<?php echo esc_attr( $field['id'] ); ?>]" id="field_options_captcha_size_<?php echo esc_attr( $field['id'] ); ?>">
227 388 <option value="normal" <?php selected( $field['captcha_size'], 'normal' ); ?>>
228 389 <?php esc_html_e( 'Normal', 'formidable' ); ?>
@@ -231,11 +392,13 @@
231 392 <?php esc_html_e( 'Compact', 'formidable' ); ?>
232 393 </option>
233 394 </select>
234 395 </p>
396 + <?php } ?>
397 + <?php if ( $display['captcha_theme'] ) { ?>
235 398 <p class="frm6 frm_form_field">
236 399 <label for="captcha_theme_<?php echo esc_attr( $field['field_key'] ); ?>">
237 - <?php esc_html_e( 'reCAPTCHA Color', 'formidable' ); ?>
400 + <?php esc_html_e( 'Captcha Theme', 'formidable' ); ?>
238 401 </label>
239 402 <select name="field_options[captcha_theme_<?php echo esc_attr( $field['id'] ); ?>]" id="captcha_theme_<?php echo esc_attr( $field['field_key'] ); ?>">
240 403 <option value="light" <?php selected( $field['captcha_theme'], 'light' ); ?>>
241 404 <?php esc_html_e( 'Light', 'formidable' ); ?>
@@ -242,18 +405,17 @@
242 405 </option>
243 406 <option value="dark" <?php selected( $field['captcha_theme'], 'dark' ); ?>>
244 407 <?php esc_html_e( 'Dark', 'formidable' ); ?>
245 408 </option>
409 + <?php if ( $display['captcha_theme_auto_option'] ) { ?>
410 + <option value="auto" <?php selected( $field['captcha_theme'], 'auto' ); ?>>
411 + <?php esc_html_e( 'Auto', 'formidable' ); ?>
412 + </option>
413 + <?php } ?>
246 414 </select>
247 415 </p>
248 416 <?php } ?>
249 417
250 - <?php
251 - if ( $display['format'] ) {
252 - FrmFieldsController::show_format_option( $field );
253 - }
254 - ?>
255 -
256 418 <?php do_action( 'frm_field_options', compact( 'field', 'display', 'values' ) ); ?>
257 419
258 420 <?php if ( $display['required'] ) { ?>
259 421 <p class="frm6 frm_form_field frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>">
@@ -271,26 +433,37 @@
271 433 <option value="" <?php selected( $field['label'], '' ); ?>>
272 434 <?php esc_html_e( 'Default', 'formidable' ); ?>
273 435 </option>
274 436 <?php
275 - foreach ( FrmStylesHelper::get_single_label_positions() as $pos => $pos_label ) {
437 + foreach ( FrmStylesHelper::get_single_label_positions( $field ) as $pos => $pos_label ) {
276 438 if ( ! $display['clear_on_focus'] && 'inside' === $pos ) {
277 439 // Don't allow inside labels for fields without placeholders.
278 440 continue;
279 441 }
280 - ?>
281 - <option value="<?php echo esc_attr( $pos ); ?>"<?php selected( $field['label'], $pos ); ?>>
282 - <?php echo esc_html( $pos_label ); ?>
283 - </option>
284 - <?php } ?>
285 - <?php if ( $field['type'] === 'divider' ) { ?>
286 - <option value="center" <?php selected( $field['label'], 'center' ); ?>>
287 - <?php esc_html_e( 'Center', 'formidable' ); ?>
288 - </option>
289 - <?php } ?>
442 + FrmHtmlHelper::echo_dropdown_option(
443 + $pos_label,
444 + $pos === $field['label'],
445 + array(
446 + 'value' => $pos,
447 + )
448 + );
449 + }
450 +
451 + if ( $field['type'] === 'divider' ) {
452 + FrmHtmlHelper::echo_dropdown_option(
453 + __( 'Center', 'formidable' ),
454 + 'center' === $field['label'],
455 + array(
456 + 'value' => 'center',
457 + )
458 + );
459 + }
460 + ?>
290 461 </select>
291 462 </p>
292 - <?php } ?>
463 + <?php
464 + }//end if
465 + ?>
293 466
294 467 <p class="frm6 frm_form_field">
295 468 <label for="field_options_field_key_<?php echo esc_attr( $field['id'] ); ?>" class="frm_help" title="<?php esc_attr_e( 'The field key can be used as an alternative to the field ID in many cases.', 'formidable' ); ?>">
296 469 <?php esc_html_e( 'Field Key', 'formidable' ); ?>
@@ -303,14 +476,25 @@
303 476 <label for="field_options_type_<?php echo esc_attr( $field['id'] ); ?>">
304 477 <?php esc_html_e( 'Field Type', 'formidable' ); ?>
305 478 </label>
306 479 <select name="field_options[type_<?php echo esc_attr( $field['id'] ); ?>]" id="field_options_type_<?php echo esc_attr( $field['id'] ); ?>">
307 - <?php foreach ( $field_types as $fkey => $ftype ) { ?>
308 - <option value="<?php echo esc_attr( $fkey ); ?>" <?php echo ( $fkey === $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists( $fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>>
309 - <?php echo esc_html( is_array( $ftype ) ? $ftype['name'] : $ftype ); ?>
310 - </option>
311 - <?php
312 - unset( $fkey, $ftype );
480 + <?php
481 + foreach ( $field_types as $fkey => $ftype ) {
482 + // We need to avoid the word "select" in POST requests.
483 + // When "dropdown" is sent as a type value, we'll map it back to "select" with PHP.
484 + $type_option_value = 'select' === $fkey ? 'dropdown' : $fkey;
485 + $type_option_params = array( 'value' => $type_option_value );
486 +
487 + if ( array_key_exists( $fkey, $disabled_fields ) ) {
488 + $type_option_params['disabled'] = 'disabled';
489 + }
490 +
491 + FrmHtmlHelper::echo_dropdown_option(
492 + is_array( $ftype ) ? $ftype['name'] : $ftype,
493 + $fkey === $field['type'],
494 + $type_option_params
495 + );
496 + unset( $fkey, $ftype, $type_option_value, $type_option_params );
313 497 }
314 498 ?>
315 499 </select>
316 500 </p>
@@ -315,13 +499,17 @@
315 499 </select>
316 500 </p>
317 501 <?php } else { ?>
318 502 <input type="hidden" id="field_options_type_<?php echo esc_attr( $field['id'] ); ?>" value="<?php echo esc_attr( $field['type'] ); ?>" />
319 - <?php } ?>
503 + <?php
504 + }//end if
505 + ?>
320 506
321 507 <table class="form-table frm-mt-0">
322 - <?php $field_obj->show_options( $field, $display, $values ); ?>
323 - <?php do_action( 'frm_field_options_form', $field, $display, $values ); ?>
508 + <?php
509 + $field_obj->show_options( $field, $display, $values );
510 + do_action( 'frm_field_options_form', $field, $display, $values );
511 + ?>
324 512 </table>
325 513 </div>
326 514
327 515 <?php if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
@@ -326,14 +514,16 @@
326 514
327 515 <?php if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
328 516 <?php
329 517 $hidden_invalid = FrmField::is_field_type( $field, 'text' ) && ! FrmField::is_option_true( $field, 'format' ) && FrmField::is_option_empty( $field, 'max' );
330 - $has_validation = ( ( $display['invalid'] && ! $hidden_invalid ) || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) );
518 + $has_validation = ( $display['invalid'] && ! $hidden_invalid ) || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' );
331 519 ?>
332 520 <div class="frm_validation_msg <?php echo esc_attr( $has_validation ? '' : 'frm_hidden' ); ?>">
333 - <h3 class="frm-collapsed" aria-expanded="false" tabindex="0" role="button" aria-label="<?php esc_html_e( 'Collapsible Validation Messages Settings', 'formidable' ); ?>" aria-controls="collapsible-section">
334 - <?php esc_html_e( 'Validation Messages', 'formidable' ); ?>
335 - <?php FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) ); ?>
521 + <h3 class="frm-collapsed" aria-expanded="false" tabindex="0" role="button" aria-label="<?php esc_attr_e( 'Collapsible Validation Messages Settings', 'formidable' ); ?>" aria-controls="collapsible-section">
522 + <?php
523 + esc_html_e( 'Validation Messages', 'formidable' );
524 + FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown8_icon', array( 'aria-hidden' => 'true' ) );
525 + ?>
336 526 </h3>
337 527
338 528 <div class="frm_validation_box frm-collapse-me" role="group">
339 529 <?php if ( $display['required'] ) { ?>
@@ -340,9 +530,9 @@
340 530 <p class="frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>">
341 531 <label for="field_options_blank_<?php echo esc_attr( $field['id'] ); ?>">
342 532 <?php esc_html_e( 'Required', 'formidable' ); ?>
343 533 </label>
344 - <input type="text" name="field_options[blank_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['blank'] ); ?>" id="field_options_blank_<?php echo esc_attr( $field['id'] ); ?>"/>
534 + <input type="text" name="field_options[blank_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['blank'] ); ?>" id="field_options_blank_<?php echo esc_attr( $field['id'] ); ?>" />
345 535 </p>
346 536 <?php } ?>
347 537
348 538 <?php if ( $display['invalid'] ) { ?>
@@ -349,9 +539,9 @@
349 539 <p class="frm_invalid_msg<?php echo esc_attr( $field['id'] . ( $hidden_invalid ? ' frm_hidden' : '' ) ); ?>">
350 540 <label for="field_options_invalid_<?php echo esc_attr( $field['id'] ); ?>">
351 541 <?php esc_html_e( 'Invalid Format', 'formidable' ); ?>
352 542 </label>
353 - <input type="text" name="field_options[invalid_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['invalid'] ); ?>" id="field_options_invalid_<?php echo esc_attr( $field['id'] ); ?>"/>
543 + <input type="text" name="field_options[invalid_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['invalid'] ); ?>" id="field_options_invalid_<?php echo esc_attr( $field['id'] ); ?>" />
354 544 </p>
355 545 <?php
356 546 }
357 547
@@ -375,12 +565,22 @@
375 565 <input type="text" name="field_options[conf_msg_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['conf_msg'] ); ?>" id="field_options_conf_msg_<?php echo esc_attr( $field['id'] ); ?>" />
376 566 </p>
377 567 <?php
378 568 }
569 +
570 + /**
571 + * @since 6.28
572 + *
573 + * @param array $display
574 + * @param array $field
575 + */
576 + do_action( 'frm_field_validation_messages', $display, $field );
379 577 ?>
380 578 </div>
381 579 </div>
382 - <?php } ?>
580 + <?php
581 + }//end if
582 + ?>
383 583
384 584 <?php do_action( 'frm_after_field_options', compact( 'field', 'display', 'values' ) ); ?>
385 585
386 586 <?php if ( $display['conf_field'] ) { ?>