| @@ -47,18 +47,11 @@ | ||
| 47 | 47 | $form_style = Form_Styling::get_style_attr( $form_id ); |
| 48 | 48 | $nonce_action = Helper::get_donation_nonce_action( $campaign_id ); |
| 49 | 49 | $blocks = parse_blocks( $form->post_content ); |
| 50 | 50 | |
| 51 | - // Marker class when default styling is disabled, so custom CSS can | |
| 52 | - // target the unstyled state (get_style_attr already returned ''). | |
| 53 | - $container_classes = 'sd-form-container'; | |
| 54 | - if ( Form_Styling::is_default_styling_disabled( $form_id ) ) { | |
| 55 | - $container_classes .= ' sd-styling-none'; | |
| 56 | - } | |
| 57 | - | |
| 58 | 51 | ob_start(); |
| 59 | 52 | ?> |
| 60 | - <div id="<?php echo esc_attr( $unique_form_id ); ?>" class="<?php echo esc_attr( $container_classes ); ?>" data-form-id="<?php echo esc_attr( (string) $form_id ); ?>" data-campaign-id="<?php echo esc_attr( (string) $campaign_id ); ?>"<?php echo '' !== $form_style ? ' style="' . esc_attr( $form_style ) . '"' : ''; ?>> | |
| 53 | + <div id="<?php echo esc_attr( $unique_form_id ); ?>" class="sd-form-container" data-form-id="<?php echo esc_attr( (string) $form_id ); ?>" data-campaign-id="<?php echo esc_attr( (string) $campaign_id ); ?>"<?php echo '' !== $form_style ? ' style="' . esc_attr( $form_style ) . '"' : ''; ?>> | |
| 61 | 54 | <form class="sd-form" method="post"> |
| 62 | 55 | <?php wp_nonce_field( $nonce_action, 'suredonation_nonce' ); ?> |
| 63 | 56 | <input type="hidden" name="form_id" value="<?php echo esc_attr( (string) $form_id ); ?>"> |
| 64 | 57 | <input type="hidden" name="campaign_id" value="<?php echo esc_attr( (string) $campaign_id ); ?>"> |
| @@ -68,35 +61,14 @@ | ||
| 68 | 61 | <input type="hidden" name="action" value="suredonation_submit_donation"> |
| 69 | 62 | <?php Helper::render_honeypot_field(); ?> |
| 70 | 63 | |
| 71 | 64 | <?php |
| 72 | - // Privacy fields (consent / privacy policy / terms) enabled in the | |
| 73 | - // Privacy settings are injected as the last thing before the submit | |
| 74 | - // button so the donor sees them right before submitting. Anchor on the | |
| 75 | - // donate button; if a form has none, fall back to the payment block, and | |
| 76 | - // finally to the end of the form. The anchor may be nested inside a | |
| 77 | - // layout block (Group/Columns), so match the top-level block that either | |
| 78 | - // is, or contains, the anchor. | |
| 79 | - $privacy_fields = \SureDonation\Inc\Privacy\Privacy_Frontend::render_form_fields(); | |
| 80 | - $privacy_anchor = Helper::block_tree_contains( $blocks, 'suredonation/donate-button' ) ? 'suredonation/donate-button' : 'suredonation/payment'; | |
| 81 | - $privacy_injected = false; | |
| 82 | 65 | foreach ( $blocks as $block ) { |
| 83 | 66 | if ( empty( $block['blockName'] ) ) { |
| 84 | 67 | continue; |
| 85 | 68 | } |
| 86 | - $is_anchor = $block['blockName'] === $privacy_anchor | |
| 87 | - || ( ! empty( $block['innerBlocks'] ) && is_array( $block['innerBlocks'] ) && Helper::block_tree_contains( $block['innerBlocks'], $privacy_anchor ) ); | |
| 88 | - if ( ! $privacy_injected && '' !== $privacy_fields && $is_anchor ) { | |
| 89 | - echo wp_kses( $privacy_fields, Helper::get_allowed_form_html() ); | |
| 90 | - $privacy_injected = true; | |
| 91 | - } | |
| 92 | 69 | $block['attrs']['formId'] = $form_id; |
| 93 | - // Allow the data: protocol so a lazy-load optimizer's inline SVG | |
| 94 | - // placeholder (Image block) survives this second kses pass. | |
| 95 | - echo wp_kses( render_block( $block ), Helper::get_allowed_form_html(), array_merge( wp_allowed_protocols(), [ 'data' ] ) ); | |
| 96 | - } | |
| 97 | - if ( ! $privacy_injected && '' !== $privacy_fields ) { | |
| 98 | - echo wp_kses( $privacy_fields, Helper::get_allowed_form_html() ); | |
| 70 | + echo wp_kses( render_block( $block ), Helper::get_allowed_form_html() ); | |
| 99 | 71 | } |
| 100 | 72 | ?> |
| 101 | 73 | </form> |
| 102 | 74 | <!-- Success Message Container --> |