class-evf-field-address.php
1 week ago
class-evf-field-ai.php
1 year ago
class-evf-field-captcha.php
1 month ago
class-evf-field-checkbox.php
3 months ago
class-evf-field-color.php
1 month ago
class-evf-field-country.php
3 months ago
class-evf-field-credit-card.php
1 month ago
class-evf-field-date-time.php
1 month ago
class-evf-field-divider.php
2 years ago
class-evf-field-email.php
1 year ago
class-evf-field-file-upload.php
1 year ago
class-evf-field-first-name.php
1 year ago
class-evf-field-hcaptcha.php
5 months ago
class-evf-field-hidden.php
1 year ago
class-evf-field-html.php
10 months ago
class-evf-field-image-upload.php
1 year ago
class-evf-field-last-name.php
1 year ago
class-evf-field-likert.php
1 year ago
class-evf-field-lookup.php
1 month ago
class-evf-field-number.php
1 year ago
class-evf-field-password.php
1 month ago
class-evf-field-payment-authorize-net.php
1 month ago
class-evf-field-payment-checkbox.php
1 month ago
class-evf-field-payment-coupon.php
1 month ago
class-evf-field-payment-gateway-selector.php
1 month ago
class-evf-field-payment-quantity.php
1 month ago
class-evf-field-payment-radio.php
1 month ago
class-evf-field-payment-single.php
1 month ago
class-evf-field-payment-square.php
2 years ago
class-evf-field-payment-subscription-plan.php
1 month ago
class-evf-field-payment-subtotal.php
1 month ago
class-evf-field-payment-total.php
1 month ago
class-evf-field-phone.php
1 year ago
class-evf-field-privacy-policy.php
3 months ago
class-evf-field-private-note.php
1 year ago
class-evf-field-progress.php
1 month ago
class-evf-field-radio.php
3 months ago
class-evf-field-range-slider.php
1 month ago
class-evf-field-rating.php
3 months ago
class-evf-field-recaptcha.php
5 months ago
class-evf-field-repeater.php
1 month ago
class-evf-field-reset.php
1 month ago
class-evf-field-scale-rating.php
1 year ago
class-evf-field-select.php
1 year ago
class-evf-field-signature.php
1 month ago
class-evf-field-text.php
1 year ago
class-evf-field-textarea.php
1 year ago
class-evf-field-title.php
2 years ago
class-evf-field-turnstile.php
5 months ago
class-evf-field-url.php
1 year ago
class-evf-field-wysiwyg.php
3 months ago
class-evf-field-yes-no.php
1 year ago
payment-amount-helpers.php
1 month ago
class-evf-field-payment-gateway-selector.php
106 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Payment Gateway field |
| 4 | * |
| 5 | * @package EverestForms\Fields |
| 6 | * @since 1.9.15 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | if ( class_exists( 'EVF_Field_Payment_Gateway_Selector', false ) ) { |
| 12 | return; |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * EVF_Field_Payment_Gateway_Selector Class. |
| 17 | * |
| 18 | * Builder-scope (read-only) version shipped in the free plugin so the field can |
| 19 | * be shown LOCKED — with its real preview and readable settings — for the Pro |
| 20 | * upsell. The full functional implementation (front-end gateway picker, payment |
| 21 | * processing) lives in Everest Forms Pro, whose class loads in place of this one |
| 22 | * when the plugin is active (this file is only autoloaded when that class is not |
| 23 | * already defined). Keep `is_pro = true` so the field stays locked. |
| 24 | */ |
| 25 | class EVF_Field_Payment_Gateway_Selector extends EVF_Form_Fields { |
| 26 | |
| 27 | /** |
| 28 | * Constructor. |
| 29 | */ |
| 30 | public function __construct() { |
| 31 | $this->name = esc_html__( 'Payment Gateway', 'everest-forms' ); |
| 32 | $this->type = 'payment-gateway-selector'; |
| 33 | $this->icon = 'evf-icon evf-icon-payment'; |
| 34 | $this->order = 45; |
| 35 | $this->group = 'payment'; |
| 36 | $this->is_pro = true; |
| 37 | $this->plan = 'personal agency themegrill-agency'; |
| 38 | $this->links = array( |
| 39 | 'image_id' => '', |
| 40 | 'vedio_id' => '', |
| 41 | ); |
| 42 | $this->settings = array( |
| 43 | 'basic-options' => array( |
| 44 | 'field_options' => array( |
| 45 | 'label', |
| 46 | 'description', |
| 47 | ), |
| 48 | ), |
| 49 | 'advanced-options' => array( |
| 50 | 'field_options' => array( |
| 51 | 'meta', |
| 52 | 'label_hide', |
| 53 | 'css', |
| 54 | ), |
| 55 | ), |
| 56 | ); |
| 57 | |
| 58 | parent::__construct(); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Field preview inside the builder. |
| 63 | * |
| 64 | * Renders a representative gateway picker (the same card grid the real |
| 65 | * Pro field shows) so the locked Pro showcase reads as the actual field — |
| 66 | * just non-interactive. |
| 67 | * |
| 68 | * @param array $field Field data and settings. |
| 69 | */ |
| 70 | public function field_preview( $field ) { |
| 71 | $this->field_preview_option( 'label', $field ); |
| 72 | |
| 73 | $gateways = array( |
| 74 | 'stripe' => array( |
| 75 | 'label' => esc_html__( 'Stripe', 'everest-forms' ), |
| 76 | 'image' => 'assets/images/payment/stripe.svg', |
| 77 | ), |
| 78 | 'paypal' => array( |
| 79 | 'label' => esc_html__( 'PayPal', 'everest-forms' ), |
| 80 | 'image' => 'assets/images/payment/paypal.svg', |
| 81 | ), |
| 82 | ); |
| 83 | // Inline styles keep the preview self-contained: the Pro grid stylesheet |
| 84 | // (evf-pgw-grid) is not loaded in the free builder, so without these the |
| 85 | // logos would render full-size and stacked. Values mirror the Pro |
| 86 | // .evf-pgw-card / .evf-pgw-logo-img rules so the showcase matches the |
| 87 | // real field. |
| 88 | $grid_style = 'display:flex;flex-wrap:wrap;gap:12px;margin-bottom:8px;pointer-events:none;'; |
| 89 | $tile_style = 'display:flex;align-items:center;justify-content:center;width:28%;min-width:130px;padding:12px;border:1.5px solid #e5e7eb;border-radius:4px;background:#fff;box-sizing:border-box;'; |
| 90 | $img_style = 'display:block;width:80px;max-width:100%;height:auto;object-fit:contain;'; |
| 91 | ?> |
| 92 | <div class="everest-forms-payment-gateway-selector-preview"> |
| 93 | <div class="evf-pgw-grid evf-pgw-grid--preview" style="<?php echo esc_attr( $grid_style ); ?>"> |
| 94 | <?php foreach ( $gateways as $slug => $gateway ) : ?> |
| 95 | <div class="evf-pgw-card evf-pgw-logo-tile" style="<?php echo esc_attr( $tile_style ); ?>"> |
| 96 | <img src="<?php echo esc_url( plugins_url( $gateway['image'], EVF_PLUGIN_FILE ) ); ?>" alt="<?php echo esc_attr( $gateway['label'] ); ?>" class="evf-pgw-logo-img" style="<?php echo esc_attr( $img_style ); ?>" /> |
| 97 | </div> |
| 98 | <?php endforeach; ?> |
| 99 | </div> |
| 100 | </div> |
| 101 | <?php |
| 102 | // Description. |
| 103 | $this->field_preview_option( 'description', $field ); |
| 104 | } |
| 105 | } |
| 106 |