PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.8.1
GiveWP – Donation Plugin and Fundraising Platform v4.16.8.1
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 / FormMigration / Steps / GiftAid.php

GiftAid.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.8.1, at src/FormMigration/Steps/GiftAid.php

48 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\FormMigration\Steps;
4
5 use Give\FormMigration\Contracts\FormMigrationStep;
6 use Give\Framework\Blocks\BlockModel;
7
8 class GiftAid extends FormMigrationStep
9 {
10
11 /**
12 * @since 3.4.0
13 *
14 * @return void
15 */
16 public function process()
17 {
18 $giftAidStatus = $this->formV2->getGiftAidStatus();
19 $useGlobalSettings = $giftAidStatus === 'global';
20
21 if (empty($giftAidStatus) || (
22 $useGlobalSettings === true &&
23 !give_is_setting_enabled(give_get_option('give_gift_aid_enable_disable', 'disabled'))
24 ) || !in_array($giftAidStatus, ['enabled', 'global'], true)) {
25 return;
26 }
27
28 $giftAidSettings = [
29 'useGlobalSettings' => $useGlobalSettings,
30 'title' => $this->formV2->getGiftAidTitle(),
31 'description' => $this->formV2->getGiftAidDescription(),
32 'longExplanationEnabled' => $this->formV2->getGiftAidLongExplanationEnabled(),
33 'linkText' => __('Tell me more', 'give-gift-aid'),
34 'modalHeader' => __('What is Gift Aid?', 'give-gift-aid'),
35 'longExplanation' => $this->formV2->getGiftAidLongExplanation(),
36 'checkboxLabel' => $this->formV2->getGiftAidCheckboxLabel(),
37 'agreementText' => $this->formV2->getGiftAidAgreementText(),
38 'declarationForm' => $this->formV2->getGiftAidDeclarationForm(),
39 ];
40
41 $giftAidBlock = BlockModel::make([
42 'name' => 'givewp-gift-aid/gift-aid',
43 'attributes' => $giftAidSettings,
44 ]);
45 $this->fieldBlocks->insertAfter('givewp/donation-amount', $giftAidBlock);
46 }
47 }
48