give
/
src
/
PaymentGateways
/
Gateways
/
Stripe
/
StripePaymentElementGateway
/
Actions
/
AddStripeAttributesToNewForms.php
give
/
src
/
PaymentGateways
/
Gateways
/
Stripe
/
StripePaymentElementGateway
/
Actions
Last commit date
AddStripeAttributesToNewForms.php
2 years ago
EnqueueStripeFormBuilderScripts.php
2 years ago
UpdateStripeFormBuilderSettingsMeta.php
2 years ago
UpdateStripeInvoiceMetaData.php
1 year ago
AddStripeAttributesToNewForms.php
27 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\PaymentGateways\Gateways\Stripe\StripePaymentElementGateway\Actions; |
| 4 | |
| 5 | |
| 6 | use Give\DonationForms\Models\DonationForm; |
| 7 | |
| 8 | class AddStripeAttributesToNewForms |
| 9 | { |
| 10 | |
| 11 | /** |
| 12 | * Add Stripe attributes to the PaymentGateways block new forms. |
| 13 | */ |
| 14 | public function __invoke(DonationForm $form) |
| 15 | { |
| 16 | $block = $form->blocks->findByName('givewp/payment-gateways'); |
| 17 | if ($block) { |
| 18 | $enabledGateways = array_keys(give_get_option('gateways_v3', [])); |
| 19 | $stripeEnabled = in_array('stripe_payment_element', $enabledGateways, true); |
| 20 | |
| 21 | if ($stripeEnabled) { |
| 22 | $block->setAttribute('stripeUseGlobalDefault', true); |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 |