PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.2
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.2
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
formidable / classes / views / frm-fields / back-end / settings.php

settings.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 5.2, at classes/views/frm-fields/back-end/settings.php

398 lines 19.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5 ?>
6 <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 <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'] ); ?>"/>
9
10 <div class="frm-sub-label alignright">
11 (ID <?php echo esc_html( $field['id'] ); ?>)
12 </div>
13 <h3>
14 <?php
15 printf(
16 /* translators: %s: Field type */
17 esc_html__( '%s Field', 'formidable' ),
18 esc_html( $type_name )
19 );
20 ?>
21 </h3>
22
23 <div class="frm_grid_container frm-collapse-me">
24 <?php if ( $display['label'] ) { ?>
25 <p>
26 <label for="frm_name_<?php echo esc_attr( $field['id'] ); ?>">
27 <?php echo esc_html( apply_filters( 'frm_builder_field_label', __( 'Field Label', 'formidable' ), $field ) ); ?>
28 </label>
29 <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'] ); ?>" />
30 </p>
31 <?php } else { ?>
32 <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'] ); ?>" />
33 <?php } ?>
34
35 <p class="frm-hide-empty">
36 <?php if ( $display['required'] ) { ?>
37 <label for="frm_req_field_<?php echo esc_attr( $field['id'] ); ?>" class="frm_inline_label">
38 <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 ); ?> />
39 <?php esc_html_e( 'Required', 'formidable' ); ?>
40 </label>
41 <?php
42 }
43
44 if ( $display['unique'] ) {
45 ?>
46 <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" />
47 <?php esc_html_e( 'Unique', 'formidable' ); ?>
48 </label>
49 <?php
50 }
51
52 if ( $display['read_only'] ) {
53 ?>
54 <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' ); ?>" >
55 <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 ); ?>/>
56 <?php esc_html_e( 'Read Only', 'formidable' ); ?>
57 </label>
58 <?php
59 }
60
61 do_action( 'frm_field_options_form_top', $field, $display, $values );
62 ?>
63 </p>
64
65 <?php
66 if ( $display['range'] ) {
67 include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/number-range.php' );
68 }
69
70 $field_obj->show_primary_options( compact( 'field', 'display', 'values' ) );
71
72 ?>
73
74 <?php if ( $display['css'] ) { ?>
75 <p class="frm-has-modal">
76 <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' ); ?>">
77 <?php esc_html_e( 'CSS Layout Classes', 'formidable' ); ?>
78 </label>
79 <span class="frm-with-right-icon">
80 <?php
81 FrmAppHelper::icon_by_class(
82 'frm_icon_font frm_more_horiz_solid_icon frm-show-inline-modal',
83 array(
84 'data-open' => 'frm-layout-classes-box',
85 'title' => esc_attr__( 'Toggle Options', 'formidable' ),
86 )
87 );
88 ?>
89 <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" />
90 </span>
91 </p>
92 <?php } ?>
93 </div>
94
95 <?php
96
97 $field_obj->show_field_choices( compact( 'field', 'display', 'values' ) );
98
99 if ( $display['clear_on_focus'] ) {
100 do_action( 'frm_extra_field_display_options', $field );
101 }
102
103 /**
104 * Fires after printing the primary options section of field.
105 *
106 * @since 5.0.04 Added `$display` and `$values`.
107 *
108 * @param array $field Field data.
109 * @param FrmFieldType $field_obj Field type object.
110 * @param array $display Display data.
111 * @param array $values Field values.
112 */
113 do_action( 'frm_before_field_options', $field, compact( 'field_obj', 'display', 'values' ) );
114
115 ?>
116
117 <h3 class="frm-collapsed">
118 <?php esc_html_e( 'Advanced', 'formidable' ); ?>
119 <i class="frm_icon_font frm_arrowdown6_icon"></i>
120 </h3>
121 <div class="frm_grid_container frm-collapse-me">
122
123 <?php if ( $display['default'] ) { ?>
124 <div class="frm-has-modal">
125 <?php if ( count( $default_value_types ) > 1 ) { ?>
126 <span class="frm-default-switcher">
127 <?php foreach ( $default_value_types as $def_name => $link ) { ?>
128 <a href="#" title="<?php echo esc_attr( $link['title'] ); ?>" class="<?php echo esc_attr( $link['class'] ); ?>" data-toggleclass="frm_hidden frm-open"
129 <?php foreach ( $link['data'] as $data_key => $data_value ) { ?>
130 data-<?php echo esc_attr( $data_key ); ?>="<?php echo esc_attr( $data_value . ( substr( $data_value, -1 ) === '-' ? $field['id'] : '' ) ); ?>"
131 <?php } ?>
132 <?php if ( isset( $link['data']['frmshow'] ) ) { ?>
133 data-frmhide=".frm-inline-modal,.default-value-section-<?php echo esc_attr( $field['id'] ); ?>"
134 <?php } ?>
135 >
136 <?php FrmAppHelper::icon_by_class( $link['icon'] ); ?>
137 </a>
138 <?php } ?>
139 </span>
140 <?php } ?>
141
142 <p class="frm-has-modal default-value-section-<?php echo esc_attr( $field['id'] . ( isset( $default_value_types['default_value']['current'] ) ? '' : ' frm_hidden' ) ); ?>" id="default-value-for-<?php echo esc_attr( $field['id'] ); ?>">
143 <label for="frm_default_value_<?php echo esc_attr( $field['id'] ); ?>">
144 <?php esc_html_e( 'Default Value', 'formidable' ); ?>
145 </label>
146 <span class="frm-with-right-icon">
147 <?php
148 $special_default = ( isset( $field['post_field'] ) && $field['post_field'] === 'post_category' ) || $field['type'] === 'data';
149 FrmAppHelper::icon_by_class(
150 'frm_icon_font frm_more_horiz_solid_icon frm-show-inline-modal',
151 array(
152 'data-open' => $special_default ? 'frm-tax-box-' . $field['id'] : 'frm-smart-values-box',
153 'title' => esc_attr__( 'Toggle Options', 'formidable' ),
154 )
155 );
156 unset( $special_default );
157
158 if ( isset( $display['default_value'] ) && $display['default_value'] ) {
159 $default_name = 'field_options[dyn_default_value_' . $field['id'] . ']';
160 $default_value = isset( $field['dyn_default_value'] ) ? $field['dyn_default_value'] : '';
161 } else {
162 $default_name = 'default_value_' . $field['id'];
163 $default_value = $field['default_value'];
164 }
165 $field_obj->default_value_to_string( $default_value );
166
167 if ( $display['type'] === 'textarea' || $display['type'] === 'rte' ) {
168 ?>
169 <textarea name="<?php echo esc_attr( $default_name ); ?>" class="default-value-field" id="frm_default_value_<?php echo esc_attr( $field['id'] ); ?>" rows="3" data-changeme="field_<?php echo esc_attr( $field['field_key'] ); ?>"><?php
170 echo FrmAppHelper::esc_textarea( $default_value ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
171 ?></textarea>
172 <?php
173 } else {
174 ?>
175 <input type="text" name="<?php echo esc_attr( $default_name ); ?>" value="<?php echo esc_attr( $default_value ); ?>" id="frm_default_value_<?php echo esc_attr( $field['id'] ); ?>" class="default-value-field" data-changeme="field_<?php echo esc_attr( $field['field_key'] ); ?>" data-changeatt="value" data-sep="<?php echo esc_attr( $field_obj->displayed_field_type( $field ) ? ',' : '' ); ?>" />
176 <?php
177 }
178 ?>
179 </span>
180 </p>
181 <?php do_action( 'frm_default_value_setting', compact( 'field', 'display', 'default_value_types' ) ); ?>
182 </div>
183 <?php } ?>
184
185 <?php $field_obj->show_after_default( compact( 'field', 'display' ) ); ?>
186
187 <?php if ( $display['clear_on_focus'] ) { ?>
188 <p>
189 <label for="frm_placeholder_<?php echo esc_attr( $field['id'] ); ?>">
190 <?php esc_html_e( 'Placeholder Text', 'formidable' ); ?>
191 </label>
192 <?php
193 if ( $display['type'] === 'textarea' || $display['type'] === 'rte' ) {
194 ?>
195 <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
196 echo FrmAppHelper::esc_textarea( $field['placeholder'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
197 ?></textarea>
198 <?php
199 } else {
200 ?>
201 <input type="text" name="field_options[placeholder_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['placeholder'] ); ?>" id="frm_placeholder_<?php echo esc_attr( $field['id'] ); ?>" data-changeme="field_<?php echo esc_attr( $field['field_key'] ); ?>" data-changeatt="placeholder" />
202 <?php
203 }
204 ?>
205 </p>
206 <?php } ?>
207
208 <?php
209 if ( $display['description'] ) {
210 include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-description.php' );
211 }
212
213 // Field Size
214 if ( $display['size'] && ! in_array( $field['type'], array( 'select', 'data', 'time' ) ) ) {
215 $display_max = $display['max'];
216 include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/pixels-wide.php' );
217 }
218 ?>
219
220 <?php if ( $display['show_image'] ) { ?>
221 <p>
222 <label for="frm_show_image_<?php echo esc_attr( $field['id'] ); ?>">
223 <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 ); ?> />
224 <?php esc_html_e( 'If this URL points to an image, show to image on the entries listing page.', 'formidable' ); ?>
225 </label>
226 </p>
227 <?php } ?>
228
229 <?php if ( $display['captcha_size'] && $frm_settings->re_type !== 'invisible' ) { ?>
230 <p class="frm6 frm_first frm_form_field">
231 <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' ); ?>">
232 <?php esc_html_e( 'ReCaptcha Type', 'formidable' ); ?>
233 </label>
234 <select name="field_options[captcha_size_<?php echo esc_attr( $field['id'] ); ?>]" id="field_options_captcha_size_<?php echo esc_attr( $field['id'] ); ?>">
235 <option value="normal" <?php selected( $field['captcha_size'], 'normal' ); ?>>
236 <?php esc_html_e( 'Normal', 'formidable' ); ?>
237 </option>
238 <option value="compact" <?php selected( $field['captcha_size'], 'compact' ); ?>>
239 <?php esc_html_e( 'Compact', 'formidable' ); ?>
240 </option>
241 </select>
242 </p>
243 <p class="frm6 frm_form_field">
244 <label for="captcha_theme_<?php echo esc_attr( $field['field_key'] ); ?>">
245 <?php esc_html_e( 'reCAPTCHA Color', 'formidable' ); ?>
246 </label>
247 <select name="field_options[captcha_theme_<?php echo esc_attr( $field['id'] ); ?>]" id="captcha_theme_<?php echo esc_attr( $field['field_key'] ); ?>">
248 <option value="light" <?php selected( $field['captcha_theme'], 'light' ); ?>>
249 <?php esc_html_e( 'Light', 'formidable' ); ?>
250 </option>
251 <option value="dark" <?php selected( $field['captcha_theme'], 'dark' ); ?>>
252 <?php esc_html_e( 'Dark', 'formidable' ); ?>
253 </option>
254 </select>
255 </p>
256 <?php } ?>
257
258 <?php
259 if ( $display['format'] ) {
260 FrmFieldsController::show_format_option( $field );
261 }
262 ?>
263
264 <?php do_action( 'frm_field_options', compact( 'field', 'display', 'values' ) ); ?>
265
266 <?php if ( $display['required'] ) { ?>
267 <p class="frm6 frm_form_field frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>">
268 <label>
269 <?php esc_html_e( 'Required Field Indicator', 'formidable' ); ?>
270 </label>
271 <input type="text" name="field_options[required_indicator_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['required_indicator'] ); ?>" />
272 </p>
273 <?php } ?>
274
275 <?php if ( $display['label_position'] ) { ?>
276 <p class="frm6 frm_form_field">
277 <label><?php esc_html_e( 'Label Position', 'formidable' ); ?></label>
278 <select name="field_options[label_<?php echo esc_attr( $field['id'] ); ?>]">
279 <option value="" <?php selected( $field['label'], '' ); ?>>
280 <?php esc_html_e( 'Default', 'formidable' ); ?>
281 </option>
282 <?php
283 foreach ( FrmStylesHelper::get_single_label_positions() as $pos => $pos_label ) {
284 if ( ! $display['clear_on_focus'] && 'inside' === $pos ) {
285 // Don't allow inside labels for fields without placeholders.
286 continue;
287 }
288 ?>
289 <option value="<?php echo esc_attr( $pos ); ?>"<?php selected( $field['label'], $pos ); ?>>
290 <?php echo esc_html( $pos_label ); ?>
291 </option>
292 <?php } ?>
293 <?php if ( $field['type'] === 'divider' ) { ?>
294 <option value="center" <?php selected( $field['label'], 'center' ); ?>>
295 <?php esc_html_e( 'Center', 'formidable' ); ?>
296 </option>
297 <?php } ?>
298 </select>
299 </p>
300 <?php } ?>
301
302 <p class="frm6 frm_form_field">
303 <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' ); ?>">
304 <?php esc_html_e( 'Field Key', 'formidable' ); ?>
305 </label>
306 <input type="text" name="field_options[field_key_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['field_key'] ); ?>" id="field_options_field_key_<?php echo esc_attr( $field['id'] ); ?>"/>
307 </p>
308
309 <?php if ( count( $field_types ) > 1 ) { ?>
310 <p class="frm6 frm_form_field">
311 <label for="field_options_type_<?php echo esc_attr( $field['id'] ); ?>">
312 <?php esc_html_e( 'Field Type', 'formidable' ); ?>
313 </label>
314 <select name="field_options[type_<?php echo esc_attr( $field['id'] ); ?>]" id="field_options_type_<?php echo esc_attr( $field['id'] ); ?>">
315 <?php foreach ( $field_types as $fkey => $ftype ) { ?>
316 <option value="<?php echo esc_attr( $fkey ); ?>" <?php echo ( $fkey === $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists( $fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>>
317 <?php echo esc_html( is_array( $ftype ) ? $ftype['name'] : $ftype ); ?>
318 </option>
319 <?php
320 unset( $fkey, $ftype );
321 }
322 ?>
323 </select>
324 </p>
325 <?php } else { ?>
326 <input type="hidden" id="field_options_type_<?php echo esc_attr( $field['id'] ); ?>" value="<?php echo esc_attr( $field['type'] ); ?>" />
327 <?php } ?>
328
329 <table class="form-table frm_no_top_margin">
330 <?php $field_obj->show_options( $field, $display, $values ); ?>
331 <?php do_action( 'frm_field_options_form', $field, $display, $values ); ?>
332 </table>
333 </div>
334
335 <?php if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
336 <?php
337 $hidden_invalid = FrmField::is_field_type( $field, 'text' ) && ! FrmField::is_option_true( $field, 'format' );
338 $has_validation = ( ( $display['invalid'] && ! $hidden_invalid ) || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) );
339 ?>
340 <div class="frm_validation_msg <?php echo esc_attr( $has_validation ? '' : 'frm_hidden' ); ?>">
341 <h3 class="frm-collapsed">
342 <?php esc_html_e( 'Validation Messages', 'formidable' ); ?>
343 <i class="frm_icon_font frm_arrowdown6_icon"></i>
344 </h3>
345
346 <div class="frm_validation_box frm-collapse-me">
347 <?php if ( $display['required'] ) { ?>
348 <p class="frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>">
349 <label for="field_options_blank_<?php echo esc_attr( $field['id'] ); ?>">
350 <?php esc_html_e( 'Required', 'formidable' ); ?>
351 </label>
352 <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'] ); ?>"/>
353 </p>
354 <?php } ?>
355
356 <?php if ( $display['invalid'] ) { ?>
357 <p class="frm_invalid_msg<?php echo esc_attr( $field['id'] . ( $hidden_invalid ? ' frm_hidden' : '' ) ); ?>">
358 <label for="field_options_invalid_<?php echo esc_attr( $field['id'] ); ?>">
359 <?php esc_html_e( 'Invalid Format', 'formidable' ); ?>
360 </label>
361 <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'] ); ?>"/>
362 </p>
363 <?php
364 }
365
366 if ( $display['unique'] ) {
367 ?>
368 <p class="frm_unique_details<?php echo esc_attr( $field['id'] . ( $field['unique'] ? '' : ' frm_hidden' ) ); ?>">
369 <label for="field_options_unique_msg_<?php echo esc_attr( $field['id'] ); ?>">
370 <?php esc_html_e( 'Unique', 'formidable' ); ?>
371 </label>
372 <input type="text" name="field_options[unique_msg_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['unique_msg'] ); ?>" id="field_options_unique_msg_<?php echo esc_attr( $field['id'] ); ?>" />
373 </p>
374 <?php
375 }
376
377 if ( $display['conf_field'] ) {
378 ?>
379 <p class="frm_conf_details<?php echo esc_attr( $field['id'] . ( $field['conf_field'] ? '' : ' frm_hidden' ) ); ?>">
380 <label for="field_options_conf_msg_<?php echo esc_attr( $field['id'] ); ?>">
381 <?php esc_html_e( 'Confirmation', 'formidable' ); ?>
382 </label>
383 <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'] ); ?>" />
384 </p>
385 <?php
386 }
387 ?>
388 </div>
389 </div>
390 <?php } ?>
391
392 <?php do_action( 'frm_after_field_options', compact( 'field', 'display', 'values' ) ); ?>
393
394 <?php if ( $display['conf_field'] ) { ?>
395 <input type="hidden" name="field_options[conf_desc_<?php echo esc_attr( $field['id'] ); ?>]" value="<?php echo esc_attr( $field['conf_desc'] ); ?>" />
396 <?php } ?>
397 </div>
398