FormFields
2 years ago
FormTemplate
2 years ago
ActiveCampaign.php
2 years ago
ConstantContact.php
2 years ago
ConvertKit.php
2 years ago
CurrencySwitcher.php
2 years ago
DonationGoal.php
2 years ago
DonationOptions.php
2 years ago
DoubleTheDonation.php
2 years ago
EmailSettings.php
2 years ago
FeeRecovery.php
2 years ago
FormExcerpt.php
2 years ago
FormFeaturedImage.php
2 years ago
FormFieldManager.php
2 years ago
FormFields.php
2 years ago
FormGrid.php
2 years ago
FormMeta.php
2 years ago
FormTitle.php
2 years ago
FundsAndDesignations.php
2 years ago
GiftAid.php
2 years ago
Mailchimp.php
2 years ago
MigrateMeta.php
2 years ago
OfflineDonations.php
2 years ago
PaymentGateways.php
2 years ago
PdfSettings.php
2 years ago
PerFormGateways.php
2 years ago
RazorpayPerFormSettings.php
1 year ago
RecurringDonationOptions.php
2 years ago
TermsAndConditions.php
2 years ago
GiftAid.php
48 lines
| 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 |