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 +330 -111 6.4.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,21 +44,73 @@
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 - <?php } ?>
56 + <?php
57 + }
58 +
59 + if ( $field['type'] === 'credit_card' && ! FrmAppHelper::pro_is_installed() ) {
60 + if ( ! FrmStrpLiteConnectHelper::at_least_one_mode_is_setup() && ! FrmSquareLiteConnectHelper::at_least_one_mode_is_setup() && ! FrmPayPalLiteConnectHelper::at_least_one_mode_is_setup() ) {
61 + FrmStrpLiteAppHelper::not_connected_warning();
62 + } elseif ( ! FrmTransLiteActionsController::get_actions_for_form( $field['form_id'] ) ) {
63 + ?>
64 + <div class="frm_warning_style frm-with-icon">
65 + <?php FrmAppHelper::icon_by_class( 'frmfont frm_alert_icon', array( 'style' => 'width:24px' ) ); ?>
66 + <span>
67 + <?php
68 + /* translators: %1$s: Link HTML, %2$s: End link */
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>' );
70 + ?>
71 + </span>
72 + </div>
73 + <?php
74 + }
75 + }
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 + ?>
37 106 <?php if ( $display['label'] ) { ?>
38 - <p>
107 + <p class="frm-mt-xs">
39 108 <label for="frm_name_<?php echo esc_attr( $field['id'] ); ?>">
40 - <?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 + ?>
41 113 </label>
42 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'] ); ?>" />
43 115 </p>
44 116 <?php } else { ?>
@@ -44,66 +116,93 @@
44 116 <?php } else { ?>
45 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'] ); ?>" />
46 118 <?php } ?>
47 119
48 - <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">
49 121 <?php if ( $display['required'] ) { ?>
50 - <label for="frm_req_field_<?php echo esc_attr( $field['id'] ); ?>" class="frm_inline_label">
51 - <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 ); ?> />
52 - <?php esc_html_e( 'Required', 'formidable' ); ?>
53 - </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>
54 128 <?php
55 129 }
56 130
57 - if ( $display['unique'] ) {
131 + if ( $display['unique'] || ! empty( $show_upsell_for_unique_value ) ) {
58 132 ?>
59 - <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" />
60 - <?php esc_html_e( 'Unique', 'formidable' ); ?>
61 - </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>
62 139 <?php
63 140 }
64 141
65 - if ( $display['read_only'] ) {
142 + if ( $display['read_only'] || ! empty( $show_upsell_for_read_only ) ) {
66 143 ?>
67 - <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' ); ?>" >
68 - <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 ); ?>/>
69 - <?php esc_html_e( 'Read Only', 'formidable' ); ?>
70 - </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>
71 150 <?php
72 151 }
73 -
74 152 do_action( 'frm_field_options_form_top', $field, $display, $values );
75 153 ?>
76 - </p>
154 + </div>
77 155
78 156 <?php
79 157 if ( $display['range'] ) {
80 - 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';
81 159 }
82 160
83 161 $field_obj->show_primary_options( compact( 'field', 'display', 'values' ) );
84 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 + }
85 167 ?>
86 168
87 169 <?php if ( $display['css'] ) { ?>
88 170 <p class="frm-has-modal">
89 - <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' ); ?>">
90 - <?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' ) ); ?>
91 174 </label>
92 - <span class="frm-with-right-icon">
175 + <span class="frm-with-right-icon frm-block">
93 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
94 191 FrmAppHelper::icon_by_class(
95 - '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',
96 193 array(
97 194 'data-open' => 'frm-layout-classes-box',
98 195 'title' => esc_attr__( 'Toggle Options', 'formidable' ),
196 + 'tabindex' => '0',
99 197 )
100 198 );
101 199 ?>
102 - <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" />
103 200 </span>
104 201 </p>
105 - <?php } ?>
202 + <?php
203 + }//end if
204 + ?>
106 205 </div>
107 206
108 207 <?php
109 208
@@ -117,56 +216,110 @@
117 216 * Fires after printing the primary options section of field.
118 217 *
119 218 * @since 5.0.04 Added `$display` and `$values`.
120 219 *
121 - * @param array $field Field data.
122 - * @param FrmFieldType $field_obj Field type object.
123 - * @param array $display Display data.
124 - * @param array $values Field values.
220 + * @param array $field Field data.
221 + * @param array{field_obj:FrmFieldType, display:array, values:array} $data
125 222 */
126 223 do_action( 'frm_before_field_options', $field, compact( 'field_obj', 'display', 'values' ) );
127 224
128 225 ?>
129 - <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">
130 227 <?php esc_html_e( 'Advanced', 'formidable' ); ?>
131 - <?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' ) ); ?>
132 229 </h3>
230 +
133 231 <div class="frm_grid_container frm-collapse-me" role="group">
134 -
135 232 <?php if ( $display['default'] ) { ?>
136 - <div class="frm-has-modal">
137 - <?php if ( count( $default_value_types ) > 1 ) { ?>
138 - <span class="frm-default-switcher">
139 - <?php foreach ( $default_value_types as $def_name => $link ) { ?>
140 - <a href="#" title="<?php echo esc_attr( $link['title'] ); ?>" class="<?php echo esc_attr( $link['class'] ); ?>" data-toggleclass="frm_hidden frm-open"
141 - <?php foreach ( $link['data'] as $data_key => $data_value ) { ?>
142 - data-<?php echo esc_attr( $data_key ); ?>="<?php echo esc_attr( $data_value . ( substr( $data_value, -1 ) === '-' ? $field['id'] : '' ) ); ?>"
143 - <?php } ?>
144 - <?php if ( isset( $link['data']['frmshow'] ) ) { ?>
145 - data-frmhide=".frm-inline-modal,.default-value-section-<?php echo esc_attr( $field['id'] ); ?>"
146 - <?php } ?>
147 - >
148 - <?php FrmAppHelper::icon_by_class( $link['icon'] ); ?>
149 - </a>
150 - <?php } ?>
151 - </span>
152 - <?php } ?>
233 + <div class="frm-has-modal frm-flex-col">
153 234 <?php $field_obj->show_default_value_setting( $field, $field_obj, $default_value_types, $display ); ?>
154 - <?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 + ?>
155 306 </div>
156 - <?php } ?>
307 + <?php
308 + }//end if
157 309
158 - <?php $field_obj->show_after_default( compact( 'field', 'display' ) ); ?>
310 + $field_obj->show_after_default( compact( 'field', 'display' ) );
159 311
160 - <?php if ( $display['clear_on_focus'] ) { ?>
161 - <p>
312 + if ( $display['clear_on_focus'] ) {
313 + ?>
314 + <p class="frm-flex-col">
162 315 <label for="frm_placeholder_<?php echo esc_attr( $field['id'] ); ?>">
163 - <?php esc_html_e( 'Placeholder Text', 'formidable' ); ?>
316 + <?php esc_html_e( 'Placeholder Text', 'formidable' ); ?>
164 317 </label>
165 318 <?php
166 319 if ( $display['type'] === 'textarea' || $display['type'] === 'rte' ) {
167 320 ?>
168 - <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
169 322 echo FrmAppHelper::esc_textarea( $field['placeholder'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
170 323 ?></textarea>
171 324 <?php
172 325 } else {
@@ -175,35 +328,62 @@
175 328 <?php
176 329 }
177 330 ?>
178 331 </p>
179 - <?php } ?>
332 + <?php
333 + }//end if
180 334
181 - <?php
182 335 if ( $display['description'] ) {
183 - 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';
184 337 }
185 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 +
186 354 // Field Size
187 - if ( $display['size'] && ! in_array( $field['type'], array( 'select', 'data', 'time' ) ) ) {
355 + if ( $display['size'] && ! in_array( $field['type'], array( 'select', 'data', 'time' ), true ) ) {
188 356 $display_max = $display['max'];
189 - 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';
190 358 }
191 - ?>
192 359
193 - <?php if ( $display['show_image'] ) { ?>
194 - <p>
195 - <label for="frm_show_image_<?php echo esc_attr( $field['id'] ); ?>">
196 - <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 ); ?> />
197 - <?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>
198 378 </label>
199 379 </p>
200 380 <?php } ?>
201 381
202 - <?php if ( $display['captcha_size'] && $frm_settings->re_type !== 'invisible' && $frm_settings->active_captcha === 'recaptcha' ) { ?>
382 + <?php if ( $display['captcha_size'] ) { ?>
203 383 <p class="frm6 frm_first frm_form_field">
204 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' ); ?>">
205 - <?php esc_html_e( 'ReCaptcha Type', 'formidable' ); ?>
385 + <?php esc_html_e( 'Captcha Size', 'formidable' ); ?>
206 386 </label>
207 387 <select name="field_options[captcha_size_<?php echo esc_attr( $field['id'] ); ?>]" id="field_options_captcha_size_<?php echo esc_attr( $field['id'] ); ?>">
208 388 <option value="normal" <?php selected( $field['captcha_size'], 'normal' ); ?>>
209 389 <?php esc_html_e( 'Normal', 'formidable' ); ?>
@@ -212,11 +392,13 @@
212 392 <?php esc_html_e( 'Compact', 'formidable' ); ?>
213 393 </option>
214 394 </select>
215 395 </p>
396 + <?php } ?>
397 + <?php if ( $display['captcha_theme'] ) { ?>
216 398 <p class="frm6 frm_form_field">
217 399 <label for="captcha_theme_<?php echo esc_attr( $field['field_key'] ); ?>">
218 - <?php esc_html_e( 'reCAPTCHA Color', 'formidable' ); ?>
400 + <?php esc_html_e( 'Captcha Theme', 'formidable' ); ?>
219 401 </label>
220 402 <select name="field_options[captcha_theme_<?php echo esc_attr( $field['id'] ); ?>]" id="captcha_theme_<?php echo esc_attr( $field['field_key'] ); ?>">
221 403 <option value="light" <?php selected( $field['captcha_theme'], 'light' ); ?>>
222 404 <?php esc_html_e( 'Light', 'formidable' ); ?>
@@ -223,18 +405,17 @@
223 405 </option>
224 406 <option value="dark" <?php selected( $field['captcha_theme'], 'dark' ); ?>>
225 407 <?php esc_html_e( 'Dark', 'formidable' ); ?>
226 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 } ?>
227 414 </select>
228 415 </p>
229 416 <?php } ?>
230 417
231 - <?php
232 - if ( $display['format'] ) {
233 - FrmFieldsController::show_format_option( $field );
234 - }
235 - ?>
236 -
237 418 <?php do_action( 'frm_field_options', compact( 'field', 'display', 'values' ) ); ?>
238 419
239 420 <?php if ( $display['required'] ) { ?>
240 421 <p class="frm6 frm_form_field frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>">
@@ -252,26 +433,37 @@
252 433 <option value="" <?php selected( $field['label'], '' ); ?>>
253 434 <?php esc_html_e( 'Default', 'formidable' ); ?>
254 435 </option>
255 436 <?php
256 - foreach ( FrmStylesHelper::get_single_label_positions() as $pos => $pos_label ) {
437 + foreach ( FrmStylesHelper::get_single_label_positions( $field ) as $pos => $pos_label ) {
257 438 if ( ! $display['clear_on_focus'] && 'inside' === $pos ) {
258 439 // Don't allow inside labels for fields without placeholders.
259 440 continue;
260 441 }
261 - ?>
262 - <option value="<?php echo esc_attr( $pos ); ?>"<?php selected( $field['label'], $pos ); ?>>
263 - <?php echo esc_html( $pos_label ); ?>
264 - </option>
265 - <?php } ?>
266 - <?php if ( $field['type'] === 'divider' ) { ?>
267 - <option value="center" <?php selected( $field['label'], 'center' ); ?>>
268 - <?php esc_html_e( 'Center', 'formidable' ); ?>
269 - </option>
270 - <?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 + ?>
271 461 </select>
272 462 </p>
273 - <?php } ?>
463 + <?php
464 + }//end if
465 + ?>
274 466
275 467 <p class="frm6 frm_form_field">
276 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' ); ?>">
277 469 <?php esc_html_e( 'Field Key', 'formidable' ); ?>
@@ -284,14 +476,25 @@
284 476 <label for="field_options_type_<?php echo esc_attr( $field['id'] ); ?>">
285 477 <?php esc_html_e( 'Field Type', 'formidable' ); ?>
286 478 </label>
287 479 <select name="field_options[type_<?php echo esc_attr( $field['id'] ); ?>]" id="field_options_type_<?php echo esc_attr( $field['id'] ); ?>">
288 - <?php foreach ( $field_types as $fkey => $ftype ) { ?>
289 - <option value="<?php echo esc_attr( $fkey ); ?>" <?php echo ( $fkey === $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists( $fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>>
290 - <?php echo esc_html( is_array( $ftype ) ? $ftype['name'] : $ftype ); ?>
291 - </option>
292 - <?php
293 - 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 );
294 497 }
295 498 ?>
296 499 </select>
297 500 </p>
@@ -296,13 +499,17 @@
296 499 </select>
297 500 </p>
298 501 <?php } else { ?>
299 502 <input type="hidden" id="field_options_type_<?php echo esc_attr( $field['id'] ); ?>" value="<?php echo esc_attr( $field['type'] ); ?>" />
300 - <?php } ?>
503 + <?php
504 + }//end if
505 + ?>
301 506
302 507 <table class="form-table frm-mt-0">
303 - <?php $field_obj->show_options( $field, $display, $values ); ?>
304 - <?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 + ?>
305 512 </table>
306 513 </div>
307 514
308 515 <?php if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
@@ -307,14 +514,16 @@
307 514
308 515 <?php if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
309 516 <?php
310 517 $hidden_invalid = FrmField::is_field_type( $field, 'text' ) && ! FrmField::is_option_true( $field, 'format' ) && FrmField::is_option_empty( $field, 'max' );
311 - $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' );
312 519 ?>
313 520 <div class="frm_validation_msg <?php echo esc_attr( $has_validation ? '' : 'frm_hidden' ); ?>">
314 - <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">
315 - <?php esc_html_e( 'Validation Messages', 'formidable' ); ?>
316 - <?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 + ?>
317 526 </h3>
318 527
319 528 <div class="frm_validation_box frm-collapse-me" role="group">
320 529 <?php if ( $display['required'] ) { ?>
@@ -321,9 +530,9 @@
321 530 <p class="frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>">
322 531 <label for="field_options_blank_<?php echo esc_attr( $field['id'] ); ?>">
323 532 <?php esc_html_e( 'Required', 'formidable' ); ?>
324 533 </label>
325 - <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'] ); ?>" />
326 535 </p>
327 536 <?php } ?>
328 537
329 538 <?php if ( $display['invalid'] ) { ?>
@@ -330,9 +539,9 @@
330 539 <p class="frm_invalid_msg<?php echo esc_attr( $field['id'] . ( $hidden_invalid ? ' frm_hidden' : '' ) ); ?>">
331 540 <label for="field_options_invalid_<?php echo esc_attr( $field['id'] ); ?>">
332 541 <?php esc_html_e( 'Invalid Format', 'formidable' ); ?>
333 542 </label>
334 - <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'] ); ?>" />
335 544 </p>
336 545 <?php
337 546 }
338 547
@@ -356,12 +565,22 @@
356 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'] ); ?>" />
357 566 </p>
358 567 <?php
359 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 );
360 577 ?>
361 578 </div>
362 579 </div>
363 - <?php } ?>
580 + <?php
581 + }//end if
582 + ?>
364 583
365 584 <?php do_action( 'frm_after_field_options', compact( 'field', 'display', 'values' ) ); ?>
366 585
367 586 <?php if ( $display['conf_field'] ) { ?>