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
PerFormGateways.php
39 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\FormMigration\Steps; |
| 4 | |
| 5 | use Give\FormMigration\Contracts\FormMigrationStep; |
| 6 | |
| 7 | /** |
| 8 | * @since 3.3.0 |
| 9 | */ |
| 10 | class PerFormGateways extends FormMigrationStep |
| 11 | { |
| 12 | /** |
| 13 | * @since 3.3.0 |
| 14 | */ |
| 15 | public function process() |
| 16 | { |
| 17 | $paymentGatewaysBlock = $this->fieldBlocks->findByName('givewp/payment-gateways'); |
| 18 | |
| 19 | $perFormGateways = give()->form_meta->get_meta($this->formV2->id, '_give_per_form_gateways', true); |
| 20 | $compatibleGateways = array_keys(give_get_enabled_payment_gateways(0, 3)); |
| 21 | $gateways = []; |
| 22 | if (is_array($perFormGateways) && count($perFormGateways) > 0) { |
| 23 | foreach ($perFormGateways as $key => $checked) { |
| 24 | if (in_array($key, $compatibleGateways)) { |
| 25 | $gateways[] = [ |
| 26 | 'id' => $key, |
| 27 | 'label' => give_get_gateway_checkout_label($key), |
| 28 | 'value' => $key, |
| 29 | 'checked' => (bool)$checked, |
| 30 | ]; |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | $paymentGatewaysBlock->setAttribute('useDefaultGateways', count($gateways) === 0); |
| 36 | $paymentGatewaysBlock->setAttribute('perFormGateways', $gateways); |
| 37 | } |
| 38 | } |
| 39 |