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-entries/form.php +36 -12 6.5.3 → trunk View file →
@@ -2,9 +2,21 @@
2 2 if ( ! defined( 'ABSPATH' ) ) {
3 3 die( 'You are not allowed to call this page directly.' );
4 4 }
5 5
6 -if ( empty( $values ) || ! isset( $values['fields'] ) || empty( $values['fields'] ) ) { ?>
6 +// Temporarily remove the [input] shortcode if it exists to avoid conflicts.
7 +// This includes the Payment form by Paystack plugin.
8 +global $shortcode_tags;
9 +
10 +// Store the current callbacks for the shortcode
11 +$original_input_shortcode_callback = $shortcode_tags['input'] ?? false;
12 +
13 +// Remove the shortcode
14 +remove_shortcode( 'input' );
15 +
16 +$only_contain_submit = isset( $values['fields'] ) && FrmSubmitHelper::only_contains_submit_field( $values['fields'] );
17 +
18 +if ( empty( $values ) || empty( $values['fields'] ) || $only_contain_submit ) { ?>
7 19 <div class="frm_forms <?php echo esc_attr( FrmFormsHelper::get_form_style_class( $form ) ); ?>" id="frm_form_<?php echo esc_attr( $form->id ); ?>_container">
8 20 <div class="frm_error_style">
9 21 <strong><?php esc_html_e( 'Oops!', 'formidable' ); ?></strong>
10 22 <?php
@@ -48,9 +60,9 @@
48 60 <?php if ( isset( $id ) ) { ?>
49 61 <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
50 62 <?php } ?>
51 63 <?php
52 -if ( $values['fields'] ) {
64 +if ( ! $only_contain_submit ) {
53 65 /**
54 66 * Allows modifying the list of fields in the frontend form.
55 67 *
56 68 * @since 5.0.04
@@ -58,13 +70,18 @@
58 70 * @param array $fields Array of fields.
59 71 * @param array $args The arguments. Contains `form`.
60 72 */
61 73 $fields_to_show = apply_filters( 'frm_fields_in_form', $values['fields'], compact( 'form' ) );
74 +
75 + if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) {
76 + // Remove submit field when add or edit entry in backend.
77 + FrmSubmitHelper::remove_submit_field_from_list( $fields_to_show );
78 + }
79 +
62 80 FrmFieldsHelper::show_fields( $fields_to_show, $errors, $form, $form_action );
63 -}
81 +}//end if
64 82
65 -$frm_settings = FrmAppHelper::get_settings();
66 -if ( FrmAppHelper::is_admin() ) {
83 +if ( FrmAppHelper::is_admin() && ( ! isset( $_GET['action'] ) || 'elementor' !== $_GET['action'] ) ) {
67 84 ?>
68 85 <div class="frm_form_field form-field">
69 86 <label class="frm_primary_label"><?php esc_html_e( 'Entry Key', 'formidable' ); ?></label>
70 87 <input type="text" name="item_key" value="<?php echo esc_attr( $values['item_key'] ); ?>" />
@@ -80,16 +97,17 @@
80 97
81 98 do_action( 'frm_entry_form', $form, $form_action, $errors );
82 99
83 100 global $frm_vars;
84 -// close open section div
85 -if ( isset( $frm_vars['div'] ) && $frm_vars['div'] ) {
101 +
102 +// Close open section div
103 +if ( ! empty( $frm_vars['div'] ) ) {
86 104 echo "</div>\n";
87 105 unset( $frm_vars['div'] );
88 106 }
89 107
90 -// close open collapsible toggle div
91 -if ( isset( $frm_vars['collapse_div'] ) && $frm_vars['collapse_div'] ) {
108 +// Close open collapsible toggle div
109 +if ( ! empty( $frm_vars['collapse_div'] ) ) {
92 110 echo "</div>\n";
93 111 unset( $frm_vars['collapse_div'] );
94 112 }
95 113
@@ -94,9 +112,9 @@
94 112 }
95 113
96 114 echo FrmAppHelper::maybe_kses( FrmFormsHelper::replace_shortcodes( $values['after_html'], $form ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
97 115
98 -if ( FrmForm::show_submit( $form ) ) {
116 +if ( FrmForm::show_submit( $form ) && ! FrmSubmitHelper::has_submit_field_on_current_page( $values ) ) {
99 117 /**
100 118 * @since 5.5.1
101 119 */
102 120 do_action( 'frm_before_submit_btn', compact( 'form' ) );
@@ -103,9 +121,9 @@
103 121
104 122 $copy_values = $values;
105 123 unset( $copy_values['fields'] );
106 124
107 - if ( isset( $form->options['form_class'] ) && strpos( $form->options['form_class'], 'frm_inline_success' ) !== false ) {
125 + if ( isset( $form->options['form_class'] ) && str_contains( $form->options['form_class'], 'frm_inline_success' ) ) {
108 126 ob_start();
109 127 ob_implicit_flush( false );
110 128 FrmFormsHelper::get_custom_submit( $copy_values['submit_html'], $form, $submit, $form_action, $copy_values );
111 129 $clip = ob_get_clean();
@@ -123,9 +141,9 @@
123 141 /**
124 142 * @since 5.5.1
125 143 */
126 144 do_action( 'frm_after_submit_btn', compact( 'form' ) );
127 -}
145 +}//end if
128 146 ?>
129 147 </div>
130 148 </fieldset>
131 149 </div>
@@ -131,4 +149,10 @@
131 149 </div>
132 150 <?php if ( has_action( 'frm_entries_footer_scripts' ) ) { ?>
133 151 <script type="text/javascript"><?php do_action( 'frm_entries_footer_scripts', $values['fields'], $form ); ?></script>
134 152 <?php } ?>
153 +
154 +<?php
155 +// Add the shortcode back with the original callbacks
156 +if ( $original_input_shortcode_callback ) {
157 + add_shortcode( 'input', $original_input_shortcode_callback );
158 +}