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 +337 -119 6.4.1 → 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,14 +26,11 @@
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 - <h3>
32 + <h3 aria-expanded="true">
14 33 <?php
15 34 printf(
16 35 /* translators: %s: Field type */
17 36 esc_html__( '%s Field', 'formidable' ),
@@ -17,28 +36,81 @@
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 - <div class="frm_grid_container frm-collapse-me">
43 + <div class="frm_grid_container frm-collapse-me" role="group">
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,57 +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 -
130 - <h3 class="frm-collapsed">
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">
131 227 <?php esc_html_e( 'Advanced', 'formidable' ); ?>
132 - <?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' ) ); ?>
133 229 </h3>
134 - <div class="frm_grid_container frm-collapse-me">
135 230
231 + <div class="frm_grid_container frm-collapse-me" role="group">
136 232 <?php if ( $display['default'] ) { ?>
137 - <div class="frm-has-modal">
138 - <?php if ( count( $default_value_types ) > 1 ) { ?>
139 - <span class="frm-default-switcher">
140 - <?php foreach ( $default_value_types as $def_name => $link ) { ?>
141 - <a href="#" title="<?php echo esc_attr( $link['title'] ); ?>" class="<?php echo esc_attr( $link['class'] ); ?>" data-toggleclass="frm_hidden frm-open"
142 - <?php foreach ( $link['data'] as $data_key => $data_value ) { ?>
143 - data-<?php echo esc_attr( $data_key ); ?>="<?php echo esc_attr( $data_value . ( substr( $data_value, -1 ) === '-' ? $field['id'] : '' ) ); ?>"
144 - <?php } ?>
145 - <?php if ( isset( $link['data']['frmshow'] ) ) { ?>
146 - data-frmhide=".frm-inline-modal,.default-value-section-<?php echo esc_attr( $field['id'] ); ?>"
147 - <?php } ?>
148 - >
149 - <?php FrmAppHelper::icon_by_class( $link['icon'] ); ?>
150 - </a>
151 - <?php } ?>
152 - </span>
153 - <?php } ?>
233 + <div class="frm-has-modal frm-flex-col">
154 234 <?php $field_obj->show_default_value_setting( $field, $field_obj, $default_value_types, $display ); ?>
155 - <?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 + ?>
156 306 </div>
157 - <?php } ?>
307 + <?php
308 + }//end if
158 309
159 - <?php $field_obj->show_after_default( compact( 'field', 'display' ) ); ?>
310 + $field_obj->show_after_default( compact( 'field', 'display' ) );
160 311
161 - <?php if ( $display['clear_on_focus'] ) { ?>
162 - <p>
312 + if ( $display['clear_on_focus'] ) {
313 + ?>
314 + <p class="frm-flex-col">
163 315 <label for="frm_placeholder_<?php echo esc_attr( $field['id'] ); ?>">
164 - <?php esc_html_e( 'Placeholder Text', 'formidable' ); ?>
316 + <?php esc_html_e( 'Placeholder Text', 'formidable' ); ?>
165 317 </label>
166 318 <?php
167 319 if ( $display['type'] === 'textarea' || $display['type'] === 'rte' ) {
168 320 ?>
169 - <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
170 322 echo FrmAppHelper::esc_textarea( $field['placeholder'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
171 323 ?></textarea>
172 324 <?php
173 325 } else {
@@ -176,35 +328,62 @@
176 328 <?php
177 329 }
178 330 ?>
179 331 </p>
180 - <?php } ?>
332 + <?php
333 + }//end if
181 334
182 - <?php
183 335 if ( $display['description'] ) {
184 - 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';
185 337 }
186 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 +
187 354 // Field Size
188 - if ( $display['size'] && ! in_array( $field['type'], array( 'select', 'data', 'time' ) ) ) {
355 + if ( $display['size'] && ! in_array( $field['type'], array( 'select', 'data', 'time' ), true ) ) {
189 356 $display_max = $display['max'];
190 - 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';
191 358 }
192 - ?>
193 359
194 - <?php if ( $display['show_image'] ) { ?>
195 - <p>
196 - <label for="frm_show_image_<?php echo esc_attr( $field['id'] ); ?>">
197 - <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 ); ?> />
198 - <?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>
199 378 </label>
200 379 </p>
201 380 <?php } ?>
202 381
203 - <?php if ( $display['captcha_size'] && $frm_settings->re_type !== 'invisible' && $frm_settings->active_captcha === 'recaptcha' ) { ?>
382 + <?php if ( $display['captcha_size'] ) { ?>
204 383 <p class="frm6 frm_first frm_form_field">
205 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' ); ?>">
206 - <?php esc_html_e( 'ReCaptcha Type', 'formidable' ); ?>
385 + <?php esc_html_e( 'Captcha Size', 'formidable' ); ?>
207 386 </label>
208 387 <select name="field_options[captcha_size_<?php echo esc_attr( $field['id'] ); ?>]" id="field_options_captcha_size_<?php echo esc_attr( $field['id'] ); ?>">
209 388 <option value="normal" <?php selected( $field['captcha_size'], 'normal' ); ?>>
210 389 <?php esc_html_e( 'Normal', 'formidable' ); ?>
@@ -213,11 +392,13 @@
213 392 <?php esc_html_e( 'Compact', 'formidable' ); ?>
214 393 </option>
215 394 </select>
216 395 </p>
396 + <?php } ?>
397 + <?php if ( $display['captcha_theme'] ) { ?>
217 398 <p class="frm6 frm_form_field">
218 399 <label for="captcha_theme_<?php echo esc_attr( $field['field_key'] ); ?>">
219 - <?php esc_html_e( 'reCAPTCHA Color', 'formidable' ); ?>
400 + <?php esc_html_e( 'Captcha Theme', 'formidable' ); ?>
220 401 </label>
221 402 <select name="field_options[captcha_theme_<?php echo esc_attr( $field['id'] ); ?>]" id="captcha_theme_<?php echo esc_attr( $field['field_key'] ); ?>">
222 403 <option value="light" <?php selected( $field['captcha_theme'], 'light' ); ?>>
223 404 <?php esc_html_e( 'Light', 'formidable' ); ?>
@@ -224,55 +405,65 @@
224 405 </option>
225 406 <option value="dark" <?php selected( $field['captcha_theme'], 'dark' ); ?>>
226 407 <?php esc_html_e( 'Dark', 'formidable' ); ?>
227 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 } ?>
228 414 </select>
229 415 </p>
230 416 <?php } ?>
231 417
232 - <?php
233 - if ( $display['format'] ) {
234 - FrmFieldsController::show_format_option( $field );
235 - }
236 - ?>
237 -
238 418 <?php do_action( 'frm_field_options', compact( 'field', 'display', 'values' ) ); ?>
239 419
240 420 <?php if ( $display['required'] ) { ?>
241 421 <p class="frm6 frm_form_field frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>">
242 - <label>
422 + <label for="field_options_required_indicator_<?php echo esc_attr( $field['id'] ); ?>">
243 423 <?php esc_html_e( 'Required Field Indicator', 'formidable' ); ?>
244 424 </label>
245 - <input type="text" name="field_options[required_indicator_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['required_indicator'] ); ?>" />
425 + <input type="text" id="field_options_required_indicator_<?php echo esc_attr( $field['id'] ); ?>" name="field_options[required_indicator_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['required_indicator'] ); ?>" />
246 426 </p>
247 427 <?php } ?>
248 428
249 429 <?php if ( $display['label_position'] ) { ?>
250 430 <p class="frm6 frm_form_field">
251 - <label><?php esc_html_e( 'Label Position', 'formidable' ); ?></label>
252 - <select name="field_options[label_<?php echo esc_attr( $field['id'] ); ?>]">
431 + <label for="field_options_label_<?php echo esc_attr( $field['id'] ); ?>"><?php esc_html_e( 'Label Position', 'formidable' ); ?></label>
432 + <select id="field_options_label_<?php echo esc_attr( $field['id'] ); ?>" name="field_options[label_<?php echo esc_attr( $field['id'] ); ?>]">
253 433 <option value="" <?php selected( $field['label'], '' ); ?>>
254 434 <?php esc_html_e( 'Default', 'formidable' ); ?>
255 435 </option>
256 436 <?php
257 - foreach ( FrmStylesHelper::get_single_label_positions() as $pos => $pos_label ) {
437 + foreach ( FrmStylesHelper::get_single_label_positions( $field ) as $pos => $pos_label ) {
258 438 if ( ! $display['clear_on_focus'] && 'inside' === $pos ) {
259 439 // Don't allow inside labels for fields without placeholders.
260 440 continue;
261 441 }
262 - ?>
263 - <option value="<?php echo esc_attr( $pos ); ?>"<?php selected( $field['label'], $pos ); ?>>
264 - <?php echo esc_html( $pos_label ); ?>
265 - </option>
266 - <?php } ?>
267 - <?php if ( $field['type'] === 'divider' ) { ?>
268 - <option value="center" <?php selected( $field['label'], 'center' ); ?>>
269 - <?php esc_html_e( 'Center', 'formidable' ); ?>
270 - </option>
271 - <?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 + ?>
272 461 </select>
273 462 </p>
274 - <?php } ?>
463 + <?php
464 + }//end if
465 + ?>
275 466
276 467 <p class="frm6 frm_form_field">
277 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' ); ?>">
278 469 <?php esc_html_e( 'Field Key', 'formidable' ); ?>
@@ -285,14 +476,25 @@
285 476 <label for="field_options_type_<?php echo esc_attr( $field['id'] ); ?>">
286 477 <?php esc_html_e( 'Field Type', 'formidable' ); ?>
287 478 </label>
288 479 <select name="field_options[type_<?php echo esc_attr( $field['id'] ); ?>]" id="field_options_type_<?php echo esc_attr( $field['id'] ); ?>">
289 - <?php foreach ( $field_types as $fkey => $ftype ) { ?>
290 - <option value="<?php echo esc_attr( $fkey ); ?>" <?php echo ( $fkey === $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists( $fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>>
291 - <?php echo esc_html( is_array( $ftype ) ? $ftype['name'] : $ftype ); ?>
292 - </option>
293 - <?php
294 - 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 );
295 497 }
296 498 ?>
297 499 </select>
298 500 </p>
@@ -297,13 +499,17 @@
297 499 </select>
298 500 </p>
299 501 <?php } else { ?>
300 502 <input type="hidden" id="field_options_type_<?php echo esc_attr( $field['id'] ); ?>" value="<?php echo esc_attr( $field['type'] ); ?>" />
301 - <?php } ?>
503 + <?php
504 + }//end if
505 + ?>
302 506
303 507 <table class="form-table frm-mt-0">
304 - <?php $field_obj->show_options( $field, $display, $values ); ?>
305 - <?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 + ?>
306 512 </table>
307 513 </div>
308 514
309 515 <?php if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
@@ -308,23 +514,25 @@
308 514
309 515 <?php if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
310 516 <?php
311 517 $hidden_invalid = FrmField::is_field_type( $field, 'text' ) && ! FrmField::is_option_true( $field, 'format' ) && FrmField::is_option_empty( $field, 'max' );
312 - $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' );
313 519 ?>
314 520 <div class="frm_validation_msg <?php echo esc_attr( $has_validation ? '' : 'frm_hidden' ); ?>">
315 - <h3 class="frm-collapsed">
316 - <?php esc_html_e( 'Validation Messages', 'formidable' ); ?>
317 - <?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 + ?>
318 526 </h3>
319 527
320 - <div class="frm_validation_box frm-collapse-me">
528 + <div class="frm_validation_box frm-collapse-me" role="group">
321 529 <?php if ( $display['required'] ) { ?>
322 530 <p class="frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>">
323 531 <label for="field_options_blank_<?php echo esc_attr( $field['id'] ); ?>">
324 532 <?php esc_html_e( 'Required', 'formidable' ); ?>
325 533 </label>
326 - <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'] ); ?>" />
327 535 </p>
328 536 <?php } ?>
329 537
330 538 <?php if ( $display['invalid'] ) { ?>
@@ -331,9 +539,9 @@
331 539 <p class="frm_invalid_msg<?php echo esc_attr( $field['id'] . ( $hidden_invalid ? ' frm_hidden' : '' ) ); ?>">
332 540 <label for="field_options_invalid_<?php echo esc_attr( $field['id'] ); ?>">
333 541 <?php esc_html_e( 'Invalid Format', 'formidable' ); ?>
334 542 </label>
335 - <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'] ); ?>" />
336 544 </p>
337 545 <?php
338 546 }
339 547
@@ -357,12 +565,22 @@
357 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'] ); ?>" />
358 566 </p>
359 567 <?php
360 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 );
361 577 ?>
362 578 </div>
363 579 </div>
364 - <?php } ?>
580 + <?php
581 + }//end if
582 + ?>
365 583
366 584 <?php do_action( 'frm_after_field_options', compact( 'field', 'display', 'values' ) ); ?>
367 585
368 586 <?php if ( $display['conf_field'] ) { ?>