| @@ -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 | ?> |
| @@ -34,9 +56,9 @@ | ||
| 34 | 56 | <?php |
| 35 | 57 | } |
| 36 | 58 | |
| 37 | 59 | if ( $field['type'] === 'credit_card' && ! FrmAppHelper::pro_is_installed() ) { |
| 38 | - if ( ! FrmStrpLiteConnectHelper::at_least_one_mode_is_setup() && ! FrmSquareLiteConnectHelper::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() ) { | |
| 39 | 61 | FrmStrpLiteAppHelper::not_connected_warning(); |
| 40 | 62 | } elseif ( ! FrmTransLiteActionsController::get_actions_for_form( $field['form_id'] ) ) { |
| 41 | 63 | ?> |
| 42 | 64 | <div class="frm_warning_style frm-with-icon"> |
| @@ -43,9 +65,9 @@ | ||
| 43 | 65 | <?php FrmAppHelper::icon_by_class( 'frmfont frm_alert_icon', array( 'style' => 'width:24px' ) ); ?> |
| 44 | 66 | <span> |
| 45 | 67 | <?php |
| 46 | 68 | /* translators: %1$s: Link HTML, %2$s: End link */ |
| 47 | - 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>' ); | |
| 48 | 70 | ?> |
| 49 | 71 | </span> |
| 50 | 72 | </div> |
| 51 | 73 | <?php |
| @@ -83,9 +105,12 @@ | ||
| 83 | 105 | ?> |
| 84 | 106 | <?php if ( $display['label'] ) { ?> |
| 85 | 107 | <p class="frm-mt-xs"> |
| 86 | 108 | <label for="frm_name_<?php echo esc_attr( $field['id'] ); ?>"> |
| 87 | - <?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 | + ?> | |
| 88 | 113 | </label> |
| 89 | 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'] ); ?>" /> |
| 90 | 115 | </p> |
| 91 | 116 | <?php } else { ?> |
| @@ -102,13 +127,13 @@ | ||
| 102 | 127 | </div> |
| 103 | 128 | <?php |
| 104 | 129 | } |
| 105 | 130 | |
| 106 | - if ( $display['unique'] ) { | |
| 131 | + if ( $display['unique'] || ! empty( $show_upsell_for_unique_value ) ) { | |
| 107 | 132 | ?> |
| 108 | 133 | <div class="frm_form_field"> |
| 109 | - <label for="frm_uniq_field_<?php echo esc_attr( $field['id'] ); ?>" class="frm_help frm-mb-0" 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' ); ?>" data-trigger="hover"> | |
| 110 | - <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" /> | |
| 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 ); ?> /> | |
| 111 | 136 | <?php esc_html_e( 'Unique', 'formidable' ); ?> |
| 112 | 137 | </label> |
| 113 | 138 | </div> |
| 114 | 139 | <?php |
| @@ -113,13 +138,13 @@ | ||
| 113 | 138 | </div> |
| 114 | 139 | <?php |
| 115 | 140 | } |
| 116 | 141 | |
| 117 | - if ( $display['read_only'] ) { | |
| 142 | + if ( $display['read_only'] || ! empty( $show_upsell_for_read_only ) ) { | |
| 118 | 143 | ?> |
| 119 | 144 | <div class="frm_form_field"> |
| 120 | - <label for="frm_read_only_field_<?php echo esc_attr( $field['id'] ); ?>" class="frm_help frm-mb-0" 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' ); ?>" data-trigger="hover"> | |
| 121 | - <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 ); ?>/> | |
| 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 ); ?> /> | |
| 122 | 147 | <?php esc_html_e( 'Read Only', 'formidable' ); ?> |
| 123 | 148 | </label> |
| 124 | 149 | </div> |
| 125 | 150 | <?php |
| @@ -330,11 +355,23 @@ | ||
| 330 | 355 | if ( $display['size'] && ! in_array( $field['type'], array( 'select', 'data', 'time' ), true ) ) { |
| 331 | 356 | $display_max = $display['max']; |
| 332 | 357 | include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/pixels-wide.php'; |
| 333 | 358 | } |
| 334 | - ?> | |
| 335 | 359 | |
| 336 | - <?php if ( $display['show_image'] ) { ?> | |
| 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 | + ?> | |
| 337 | 374 | <p class="frm_form_field"> |
| 338 | 375 | <label class="frm-force-flex frm-gap-xs" for="frm_show_image_<?php echo esc_attr( $field['id'] ); ?>"> |
| 339 | 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 ); ?> /> |
| 340 | 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> |
| @@ -451,9 +488,9 @@ | ||
| 451 | 488 | $type_option_params['disabled'] = 'disabled'; |
| 452 | 489 | } |
| 453 | 490 | |
| 454 | 491 | FrmHtmlHelper::echo_dropdown_option( |
| 455 | - is_array( $ftype ) ? $ftype['name'] : $ftyp, | |
| 492 | + is_array( $ftype ) ? $ftype['name'] : $ftype, | |
| 456 | 493 | $fkey === $field['type'], |
| 457 | 494 | $type_option_params |
| 458 | 495 | ); |
| 459 | 496 | unset( $fkey, $ftype, $type_option_value, $type_option_params ); |