PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
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 2.30.0 All 255 releases
give / src / PaymentGateways / Gateways / Offline / Actions / UpdateOfflineMetaFromFormBuilder.php

UpdateOfflineMetaFromFormBuilder.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/PaymentGateways/Gateways/Offline/Actions/UpdateOfflineMetaFromFormBuilder.php

55 lines 1.4 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\Offline\Actions;
4
5 use Give\DonationForms\Models\DonationForm;
6
7 /**
8 * Updates the Offline gateway meta based on the form builder settings. This is done in order to use the legacy
9 * instructions function.
10 *
11 * @since 3.0.0
12 *
13 * @see give_get_offline_payment_instruction()
14 */
15 class UpdateOfflineMetaFromFormBuilder
16 {
17 public function __invoke(DonationForm $form)
18 {
19 $paymentGatewaysBlock = $form->blocks->findByName('givewp/payment-gateways');
20 if (!$paymentGatewaysBlock) {
21 return;
22 }
23
24 [
25 'offlineEnabled' => $enabled,
26 'offlineUseGlobalInstructions' => $useGlobalInstructions,
27 'offlineDonationInstructions' => $donationInstructions,
28 ] = $paymentGatewaysBlock->getAttributes() + [
29 'offlineEnabled' => true,
30 'offlineUseGlobalInstructions' => true,
31 'offlineDonationInstructions' => '',
32 ];
33
34 if (!$enabled) {
35 $modeMeta = 'disabled';
36 } elseif ($useGlobalInstructions) {
37 $modeMeta = 'global';
38 } else {
39 $modeMeta = 'enabled';
40 }
41
42 give()->form_meta->update_meta(
43 $form->id,
44 '_give_customize_offline_donations',
45 $modeMeta
46 );
47
48 give()->form_meta->update_meta(
49 $form->id,
50 '_give_offline_checkout_notes',
51 $donationInstructions
52 );
53 }
54 }
55