PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
give / src / PaymentGateways / Gateways / Stripe / StripePaymentElementGateway / Actions / EnqueueStripeFormBuilderScripts.php

EnqueueStripeFormBuilderScripts.php in GiveWP – Donation Plugin and Fundraising Platform 4.17.0, at src/PaymentGateways/Gateways/Stripe/StripePaymentElementGateway/Actions/EnqueueStripeFormBuilderScripts.php

55 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\PaymentGateways\Gateways\Stripe\StripePaymentElementGateway\Actions;
4
5 /**
6 * Class EnqueueStripeFormBuilderScripts
7 *
8 * @since 3.0.0
9 */
10 class EnqueueStripeFormBuilderScripts
11 {
12
13 /**
14 * Enqueues the Stripe scripts and styles for the Form Builder.
15 *
16 * @return void
17 */
18 public function __invoke()
19 {
20 $enabledGateways = array_keys(give_get_option('gateways_v3', []));
21 $stripeEnabled = in_array('stripe_payment_element', $enabledGateways, true);
22
23 if (!$stripeEnabled) {
24 return;
25 }
26
27 $scriptAsset = require trailingslashit(GIVE_PLUGIN_DIR) . 'build/stripePaymentElementFormBuilder.asset.php';
28
29 wp_enqueue_script(
30 'givewp-stripe-payment-element-form-builder',
31 GIVE_PLUGIN_URL . 'build/stripePaymentElementFormBuilder.js',
32 $scriptAsset['dependencies'],
33 false,
34 true
35 );
36
37 wp_localize_script(
38 'givewp-stripe-payment-element-form-builder',
39 'stripePaymentElementGatewaySettings',
40 [
41 'defaultAccount' => (bool)give_stripe_get_default_account(),
42 'allAccounts' => give_stripe_get_all_accounts(),
43 'stripeSettingsUrl' => admin_url(
44 'edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=stripe-settings&group=accounts'
45 ),
46 ]
47 );
48
49 wp_enqueue_style(
50 'givewp-stripe-payment-element-form-builder',
51 GIVE_PLUGIN_URL . 'build/stripePaymentElementFormBuilder.css'
52 );
53 }
54 }
55