| @@ -10,8 +10,9 @@ | ||
| 10 | 10 | |
| 11 | 11 | namespace SureDonation\Inc\Shortcodes; |
| 12 | 12 | |
| 13 | 13 | use SureDonation\Inc\Fields\Form_Renderer; |
| 14 | +use SureDonation\Inc\Fields\Form_Styling; | |
| 14 | 15 | use SureDonation\Inc\Helper; |
| 15 | 16 | use SureDonation\Inc\Post_Types\Donation_Form as Donation_Form_CPT; |
| 16 | 17 | use SureDonation\Inc\Traits\Get_Instance; |
| 17 | 18 | |
| @@ -105,10 +106,16 @@ | ||
| 105 | 106 | * @return void |
| 106 | 107 | * @since 0.0.1 |
| 107 | 108 | */ |
| 108 | 109 | private function enqueue_assets( $form_id, $form ) { |
| 109 | - // Enqueue the shared compiled frontend stylesheet (same handle the block uses). | |
| 110 | - wp_enqueue_style( 'suredonation-donation-form' ); | |
| 110 | + // Enqueue the shared compiled frontend stylesheet (same handle the block | |
| 111 | + // uses). Skipped when the form has default styling disabled — the site's | |
| 112 | + // own CSS then controls the appearance. Scripts are always loaded so | |
| 113 | + // payment and validation keep working. The enqueue is additive across | |
| 114 | + // forms on a page, so a styled form still loads the stylesheet. | |
| 115 | + if ( ! Form_Styling::is_default_styling_disabled( $form_id ) ) { | |
| 116 | + wp_enqueue_style( 'suredonation-donation-form' ); | |
| 117 | + } | |
| 111 | 118 | |
| 112 | 119 | // Enqueue frontend script (registered globally in Assets\Register). |
| 113 | 120 | wp_enqueue_script( 'suredonation-form-frontend' ); |
| 114 | 121 | |
| @@ -129,9 +136,10 @@ | ||
| 129 | 136 | |
| 130 | 137 | // Enqueue Stripe.js if Stripe is configured. |
| 131 | 138 | $this->maybe_enqueue_stripe(); |
| 132 | 139 | |
| 133 | - // Allow payment gateway extensions to enqueue their scripts (e.g., PayPal SDK). | |
| 140 | + // Allow payment gateway extensions to enqueue their scripts and localize | |
| 141 | + // their frontend configuration (see the action's docblock in block.php). | |
| 134 | 142 | do_action( 'suredonation_enqueue_form_frontend_scripts', $form_id, $form->post_content ); |
| 135 | 143 | } |
| 136 | 144 | |
| 137 | 145 | /** |