PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 0.0.3
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v0.0.3
2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 All 68 releases
better-payment / includes / Admin / Elementor / Better_Payment_Widget.php

Better_Payment_Widget.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 0.0.3, at includes/Admin/Elementor/Better_Payment_Widget.php

2,614 lines 103.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Better_Payment\Lite\Admin\Elementor;
4
5 use Better_Payment\Lite\Admin\Better_Payment_DB;
6 use Better_Payment\Lite\Classes\Better_Payment_Handler;
7 use \Elementor\Controls_Manager as Controls_Manager;
8 use Elementor\Core\Schemes\Typography;
9 use Elementor\Group_Control_Background;
10 use Elementor\Group_Control_Border;
11 use Elementor\Group_Control_Box_Shadow;
12 use Elementor\Group_Control_Typography;
13 use \Elementor\Repeater;
14 use Elementor\Utils;
15 use \Elementor\Widget_Base as Widget_Base;
16
17 /**
18 * Exit if accessed directly
19 */
20 if (!defined('ABSPATH')) {
21 exit;
22 }
23
24 /**
25 * The elementor widget class
26 *
27 * @since 0.0.1
28 */
29 class Better_Payment_Widget extends Widget_Base {
30
31 private $better_payment_global_settings = [];
32
33 public function get_name() {
34 return 'better-payment';
35 }
36
37 public function get_title() {
38 return esc_html__( 'Better Payment', 'better-payment' );
39 }
40
41 public function get_icon() {
42 return 'bp-icon bp-logo';
43 }
44
45 public function get_keywords() {
46 return [
47 'payment', 'better-payment' ,'paypal', 'stripe', 'sell', 'donate', 'transaction', 'online-transaction'
48 ];
49 }
50
51 public function get_style_depends() {
52 return apply_filters( 'better_payment/elementor/editor/get_style_depends', [ 'better-payment-el', 'better-payment-common-style', 'bp-icon-front', 'better-payment-style', 'better-payment-common-style', 'better-payment-admin-style' ] );
53 }
54
55 public function get_script_depends() {
56 return apply_filters( 'better_payment/elementor/editor/get_script_depends', ['better-payment-common-script', 'better-payment'] );
57 }
58
59 protected function register_controls() {
60 $this->better_payment_global_settings = Better_Payment_DB::get_settings();
61
62 $this->start_controls_section(
63 'better_payment_form_setting',
64 [
65 'label' => esc_html__( 'Payment Settings', 'better-payment' ),
66 ]
67 );
68
69 do_action('better_payment/elementor/editor/layouts_payment_settings_section', $this);
70
71 $this->add_control(
72 'better_payment_form_layout',
73 [
74 'label' => esc_html__( 'Form Layout', 'better-payment' ),
75 'type' => Controls_Manager::SELECT,
76 'default' => 'layout-1',
77 'options' => [
78 'layout-1' => 'Layout 1',
79 'layout-2' => 'Layout 2',
80 'layout-3' => 'Layout 3',
81 ],
82 ]
83 );
84
85 $this->add_control(
86 'better_payment_form_payment_source',
87 [
88 'label' => esc_html__( 'Payment Source', 'better-payment' ),
89 'type' => Controls_Manager::SELECT,
90 'default' => 'manual',
91 'options' => [
92 'manual' => 'Manual',
93 'woocommerce' => 'Woocommerce',
94 ],
95 ]
96 );
97
98 $this->add_control(
99 'better_payment_form_woocommerce_product_section',
100 [
101 'label' => __( 'Product', 'better-payment' ),
102 'type' => Controls_Manager::HIDDEN,
103 'condition' => [
104 'better_payment_form_payment_source' => 'woocommerce',
105 ],
106 ]
107 );
108
109 $this->add_control( "better_payment_form_woocommerce_product_id", [
110 'label' => __( 'Choose a Product', 'better-payment' ),
111 'description' => __( 'Enter Product IDs separated by a comma', 'better-payment' ),
112 'type' => 'better-payment-select2',
113 'label_block' => true,
114 'multiple' => false,
115 'source_type' => 'product',
116 'source_name' => 'post_type',
117 'placeholder' => __( 'Search By', 'better-payment' ),
118 'condition' => [
119 'better_payment_form_payment_source' => 'woocommerce',
120 ],
121 'separator' => 'after',
122 'default' => __( '1', 'better-payment' ),
123 'dynamic' => [
124 'active' => false,
125 ],
126 ] );
127
128 $this->add_control(
129 'better_payment_form_title',
130 [
131 'label' => __( 'Form Title', 'better-payment' ),
132 'type' => Controls_Manager::HIDDEN,
133 'dynamic' => [
134 'active' => true,
135 ],
136 'label_block' => true,
137 'default' => __( 'Form Title', 'better-payment' )
138 ]
139 );
140
141 $this->add_control(
142 'better_payment_form_paypal_enable',
143 [
144 'label' => __( 'Enable PayPal', 'better-payment' ),
145 'type' => Controls_Manager::SWITCHER,
146 'label_on' => __( 'Yes', 'better-payment' ),
147 'label_off' => __( 'No', 'better-payment' ),
148 'return_value' => 'yes',
149 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_paypal']), //yes or no
150 'separator' => 'before',
151 ]
152 );
153
154 $this->add_control(
155 'better_payment_form_stripe_enable',
156 [
157 'label' => __( 'Enable Stripe', 'better-payment' ),
158 'type' => Controls_Manager::SWITCHER,
159 'label_on' => __( 'Yes', 'better-payment' ),
160 'label_off' => __( 'No', 'better-payment' ),
161 'return_value' => 'yes',
162 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_stripe']), //yes or no
163 ]
164 );
165
166 $this->add_control(
167 'better_payment_form_email_enable',
168 [
169 'label' => __( 'Enable Email Notification', 'better-payment' ),
170 'type' => Controls_Manager::SWITCHER,
171 'label_on' => __( 'Yes', 'better-payment' ),
172 'label_off' => __( 'No', 'better-payment' ),
173 'return_value' => 'yes',
174 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_email']), //yes or no
175 ]
176 );
177
178 $better_payment_helper = new \Better_Payment\Lite\Classes\Better_Payment_Helper();
179
180 $this->add_control(
181 'better_payment_form_currency',
182 [
183 'label' => esc_html__( 'Currency Symbols', 'better-payment' ),
184 'type' => Controls_Manager::SELECT,
185 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_currency']), //USD
186 'options' => $better_payment_helper->get_currency_list(),
187 'conditions' => [
188 'relation' => 'or',
189 'terms' => [
190 [
191 'name' => 'better_payment_form_paypal_enable',
192 'value' => 'yes',
193 ],
194 [
195 'name' => 'better_payment_form_stripe_enable',
196 'value' => 'yes',
197 ],
198 ],
199 ]
200 ]
201 );
202
203 $this->end_controls_section();
204
205 $this->form_element_settings();
206 $this->paypal_form_setting();
207 $this->stripe_form_setting();
208 $this->email_element_settings();
209
210 $this->success_message_setting();
211 $this->error_message_setting();
212
213 $this->form_style();
214 }
215
216 public function form_element_settings() {
217 $this->start_controls_section(
218 'better_payment_form_element',
219 [
220 'label' => esc_html__( 'Form Settings', 'better-payment' ),
221 'conditions' => [
222 'relation' => 'or',
223 'terms' => [
224 [
225 'name' => 'better_payment_form_paypal_enable',
226 'value' => 'yes',
227 ],
228 [
229 'name' => 'better_payment_form_stripe_enable',
230 'value' => 'yes',
231 ],
232 ]
233 ]
234 ]
235 );
236
237 do_action('better_payment/elementor/editor/layouts_form_settings_section', $this);
238
239 $form_fields_repeater = new Repeater();
240
241 $form_fields_repeater->add_control(
242 'better_payment_field_name_heading',
243 [
244 'label' => __( 'Field Name', 'better-payment' ),
245 'type' => Controls_Manager::TEXT,
246 'default' => __( 'Field Name', 'better-payment' ),
247 'label_block' => false,
248 ]
249 );
250
251 $form_fields_repeater->add_control(
252 'better_payment_field_name_placeholder',
253 [
254 'label' => __( 'Placeholder Text', 'better-payment' ),
255 'type' => Controls_Manager::TEXT,
256 'default' => __( 'Field Name', 'better-payment' ),
257 'label_block' => false,
258 ]
259 );
260
261 $form_fields_repeater->add_control(
262 'better_payment_field_type',
263 [
264 'label' => __( 'Field Type', 'better-payment' ),
265 'type' => Controls_Manager::SELECT,
266 'default' => 'text',
267 'options' => [
268 'text' => __( 'Text', 'better-payment' ),
269 'email' => __( 'Email', 'better-payment' ),
270 'number' => __( 'Number', 'better-payment' ),
271 // 'password' => __( 'Password', 'better-payment' ),
272 // 'textarea' => __( 'Textarea', 'better-payment' ),
273 // 'select' => __( 'Select', 'better-payment' ),
274 // 'checkbox' => __( 'Checkbox', 'better-payment' ),
275 // 'radio' => __( 'Radio', 'better-payment' ),
276 // 'date' => __( 'Date', 'better-payment' ),
277 // 'time' => __( 'Time', 'better-payment' ),
278 // 'datetime' => __( 'Date Time', 'better-payment' ),
279 // 'file' => __( 'File', 'better-payment' ),
280 // 'hidden' => __( 'Hidden', 'better-payment' ),
281 ],
282 'label_block' => false,
283 ]
284 );
285
286 $form_fields_repeater->add_control(
287 'better_payment_field_icon',
288 [
289 'label' => esc_html__( 'Icon', 'better-payment' ),
290 'type' => Controls_Manager::ICONS,
291
292 ]
293 );
294
295 $form_fields_repeater->add_control(
296 'better_payment_field_name_show',
297 [
298 'label' => __( 'Show', 'better-payment' ),
299 'type' => Controls_Manager::SWITCHER,
300 'label_on' => __( 'Yes', 'better-payment' ),
301 'label_off' => __( 'No', 'better-payment' ),
302 'return_value' => 'yes',
303 'default' => 'yes',
304
305 ]
306 );
307
308 $form_fields_repeater->add_control(
309 'better_payment_field_name_required',
310 [
311 'label' => __( 'Required', 'better-payment' ),
312 'type' => Controls_Manager::SWITCHER,
313 'label_on' => __( 'Yes', 'better-payment' ),
314 'label_off' => __( 'No', 'better-payment' ),
315 'return_value' => 'yes',
316 'default' => 'no',
317 'condition' => [
318 'better_payment_field_name_show' => 'yes'
319 ],
320 ]
321 );
322
323 $form_fields_repeater->add_control(
324 'better_payment_field_name_display_inline',
325 [
326 'label' => __( 'Display Inline?', 'better-payment' ),
327 'type' => Controls_Manager::SWITCHER,
328 'label_on' => __( 'Yes', 'better-payment' ),
329 'label_off' => __( 'No', 'better-payment' ),
330 'return_value' => 'inline-block',
331 'default' => 'block',
332 'condition' => [
333 'better_payment_field_name_show' => 'yes'
334 ],
335 'selectors' => [
336 '{{WRAPPER}} .better-payment-form-layout form {{CURRENT_ITEM}}.bp-form__group' => 'display: {{VALUE}};',
337 '{{WRAPPER}} .better-payment-form {{CURRENT_ITEM}}.better-payment-field-advanced-layout' => 'display: {{VALUE}};',
338
339 ]
340 ]
341 );
342
343 $form_fields_repeater->add_control(
344 'better_payment_field_name_display_inline_width',
345 [
346 'label' => __( 'Column Width', 'better-payment' ),
347 'type' => Controls_Manager::SLIDER,
348 'size_units' => [ '%', 'px', 'em' ],
349 'range' => [
350 '%' => [
351 'min' => 1,
352 'max' => 100,
353 ],
354 'px' => [
355 'min' => 10,
356 'max' => 1500,
357 ],
358 'em' => [
359 'min' => 1,
360 'max' => 80,
361 ],
362 ],
363 'condition' => [
364 'better_payment_field_name_show' => 'yes',
365 'better_payment_field_name_display_inline' => 'inline-block'
366 ],
367 'selectors' => [
368 '{{WRAPPER}} .better-payment-form-layout form {{CURRENT_ITEM}}.bp-form__group' => 'width: {{SIZE}}{{UNIT}};',
369 '{{WRAPPER}} .better-payment-form {{CURRENT_ITEM}}.better-payment-field-advanced-layout' => 'width: {{SIZE}}{{UNIT}};',
370 ],
371 'description' => __( 'Set the width of the column. Use less than 50% to make fields inline', 'better-payment' ),
372 ]
373 );
374
375 $this->add_control(
376 'better_payment_form_fields',
377 [
378 'label' => esc_html__( 'Form Fields', 'better-payment' ),
379 'type' => \Elementor\Controls_Manager::REPEATER,
380 'fields' => $form_fields_repeater->get_controls(),
381 'default' => [
382 [
383 'better_payment_field_name_heading' => esc_html__( 'First Name', 'better-payment' ),
384 'better_payment_field_name_placeholder' => esc_html__( 'First Name', 'better-payment' ),
385 'better_payment_field_type' => 'text',
386 'better_payment_field_name_show' => 'yes',
387 'better_payment_field_name_required' => 'no',
388 ],
389 [
390 'better_payment_field_name_heading' => esc_html__( 'Last Name', 'better-payment' ),
391 'better_payment_field_name_placeholder' => esc_html__( 'Last Name', 'better-payment' ),
392 'better_payment_field_type' => 'text',
393 'better_payment_field_name_show' => 'yes',
394 'better_payment_field_name_required' => 'no',
395 ],
396 [
397 'better_payment_field_name_heading' => esc_html__( 'Email Address', 'better-payment' ),
398 'better_payment_field_name_placeholder' => esc_html__( 'Email Address', 'better-payment' ),
399 'better_payment_field_type' => 'email',
400 'better_payment_field_name_show' => 'yes',
401 'better_payment_field_name_required' => 'yes',
402 ],
403 ],
404 'title_field' => '{{{ better_payment_field_name_heading }}}',
405 ]
406 );
407
408 $repeater = new Repeater();
409
410
411 $repeater->add_control(
412 'better_payment_amount_val',
413 [
414 'label' => esc_html__( 'Payment Amount', 'better-payment' ),
415 'type' => Controls_Manager::NUMBER,
416 'min' => 1,
417 ]
418 );
419
420 $this->add_control(
421 'better_payment_show_payment_amount_field',
422 [
423 'label' => __( 'Show Payment Amount Field', 'better-payment' ),
424 'type' => Controls_Manager::SWITCHER,
425 'label_on' => __( 'Yes', 'better-payment' ),
426 'label_off' => __( 'No', 'better-payment' ),
427 'return_value' => 'yes',
428 'default' => 'yes',
429 'default' => 'yes',
430 'separator' => 'before',
431 'condition' => [
432 'better_payment_form_payment_source!' => 'woocommerce',
433 ],
434 ]
435 );
436
437 $this->add_control(
438 'better_payment_show_amount_list',
439 [
440 'label' => __( 'Show Amount List', 'better-payment' ),
441 'type' => Controls_Manager::SWITCHER,
442 'label_on' => __( 'Yes', 'better-payment' ),
443 'label_off' => __( 'No', 'better-payment' ),
444 'return_value' => 'yes',
445 // 'default' => 'yes',
446 'default' => 'no',
447 // 'separator' => 'before',
448 'condition' => [
449 'better_payment_form_payment_source!' => 'woocommerce',
450 ],
451 ]
452 );
453
454 $this->add_control(
455 'better_payment_amount',
456 [
457 'label' => esc_html__( 'Amount List', 'better-payment' ),
458 'type' => Controls_Manager::REPEATER,
459 'default' => [
460 [
461 'better_payment_amount_val' => 5
462 ],
463 [
464 'better_payment_amount_val' => 10
465 ],
466 [
467 'better_payment_amount_val' => 15
468 ],
469 [
470 'better_payment_amount_val' => 20
471 ],
472 ],
473 'fields' => $repeater->get_controls(),
474 'title_field' => '<i class="{{ better_payment_amount_val }}" aria-hidden="true"></i> {{{ better_payment_amount_val }}}',
475 'condition' => [
476 'better_payment_show_amount_list' => 'yes',
477 'better_payment_form_payment_source!' => 'woocommerce',
478 ],
479 ]
480 );
481
482 $this->add_control(
483 'better_payment_form_transaction_details_section',
484 [
485 'label' => esc_html__( 'Transaction Details', 'better-payment' ),
486 'type' => Controls_Manager::HEADING,
487 'separator' => 'before',
488 ]
489 );
490
491 $this->add_control(
492 'better_payment_form_transaction_details_heading',
493 [
494 'label' => esc_html__( 'Heading Text', 'better-payment' ),
495 'type' => Controls_Manager::TEXT,
496 'default' => __( 'Transaction Details', 'better-payment' ),
497 'label_block' => true,
498 ]
499 );
500
501 $this->add_control(
502 'better_payment_form_transaction_details_sub_heading',
503 [
504 'label' => esc_html__( 'Sub Heading Text', 'better-payment' ),
505 'type' => Controls_Manager::TEXT,
506 'default' => __( 'Total payment of your product in the following:', 'better-payment' ),
507 'label_block' => true,
508 ]
509 );
510
511 $this->add_control(
512 'better_payment_form_transaction_details_product_title',
513 [
514 'label' => esc_html__( 'Product Title Text', 'better-payment' ),
515 'type' => Controls_Manager::TEXT,
516 'default' => __( 'Title:', 'better-payment' ),
517 'condition' => [
518 'better_payment_form_payment_source' => 'woocommerce',
519 ],
520 'label_block' => true,
521 ]
522 );
523
524 $this->add_control(
525 'better_payment_form_transaction_details_amount_text',
526 [
527 'label' => esc_html__( 'Amount Text', 'better-payment' ),
528 'type' => Controls_Manager::TEXT,
529 'default' => __( 'Amount:', 'better-payment' ),
530 'label_block' => true,
531 ]
532 );
533
534 $this->end_controls_section();
535 }
536
537 public function paypal_form_setting() {
538 $this->start_controls_section(
539 'better_payment_form_paypal_settings',
540 [
541 'label' => esc_html__( 'PayPal Settings', 'better-payment' ),
542 'condition' => [
543 'better_payment_form_paypal_enable' => 'yes'
544 ]
545 ]
546 );
547
548
549 $this->add_control(
550 'better_payment_paypal_business_email',
551 [
552 'label' => __( 'Business Email', 'better-payment' ),
553 'type' => Controls_Manager::TEXT,
554 'dynamic' => [
555 'active' => true,
556 ],
557 'label_block' => true,
558 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_payment_paypal_email']),
559 ]
560 );
561
562 $this->add_control(
563 'better_payment_paypal_button_type',
564 [
565 'label' => esc_html__( 'Button Type', 'better-payment' ),
566 'type' => Controls_Manager::HIDDEN,
567 'default' => '_xclick',
568 'options' => [
569 '_xclick' => 'XCLICK',
570 '_cart' => 'CART',
571 '_donations' => 'DONATIONS'
572 ]
573 ]
574 );
575
576 $this->add_control(
577 'better_payment_paypal_live_mode',
578 [
579 'label' => __( 'Live Mode', 'better-payment' ),
580 'type' => Controls_Manager::SWITCHER,
581 'label_on' => __( 'Yes', 'better-payment' ),
582 'label_off' => __( 'No', 'better-payment' ),
583 'return_value' => 'yes',
584 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_payment_paypal_live_mode']), //yes or no
585 ]
586 );
587
588 $this->end_controls_section();
589 }
590
591 public function stripe_form_setting() {
592 $this->start_controls_section(
593 'better_payment_form_stripe_settings',
594 [
595 'label' => esc_html__( 'Stripe Settings', 'better-payment' ),
596 'condition' => [
597 'better_payment_form_stripe_enable' => 'yes'
598 ]
599 ]
600 );
601
602 $better_payment_is_stripe_live = $this->better_payment_global_settings['better_payment_settings_payment_stripe_live_mode'] == 'yes' ? 1 : 0;
603
604 $this->add_control(
605 'better_payment_stripe_public_key',
606 [
607 'label' => __( 'Public Key', 'better-payment' ),
608 'type' => Controls_Manager::TEXT,
609 'dynamic' => [
610 'active' => true,
611 ],
612 'label_block' => true,
613 'default' => $better_payment_is_stripe_live ? esc_html($this->better_payment_global_settings['better_payment_settings_payment_stripe_live_public']) : esc_html($this->better_payment_global_settings['better_payment_settings_payment_stripe_test_public']),
614 ]
615 );
616
617 $this->add_control(
618 'better_payment_stripe_secret_key',
619 [
620 'label' => __( 'Secret Key', 'better-payment' ),
621 'type' => Controls_Manager::TEXT,
622 'input_type' => 'password',
623 'dynamic' => [
624 'active' => true,
625 ],
626 'label_block' => true,
627 'default' => $better_payment_is_stripe_live ? esc_html($this->better_payment_global_settings['better_payment_settings_payment_stripe_live_secret']) : esc_html($this->better_payment_global_settings['better_payment_settings_payment_stripe_test_secret']),
628 ]
629 );
630
631 $this->add_control(
632 'better_payment_stripe_live_mode',
633 [
634 'label' => __( 'Live Mode', 'better-payment' ),
635 'type' => Controls_Manager::SWITCHER,
636 'label_on' => __( 'Yes', 'better-payment' ),
637 'label_off' => __( 'No', 'better-payment' ),
638 'return_value' => 'yes',
639 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_payment_paypal_live_mode']), //yes or no
640 ]
641 );
642
643 $this->end_controls_section();
644 }
645
646 public function email_element_settings() {
647 $this->start_controls_section(
648 'better_payment_email_element',
649 [
650 'label' => esc_html__( 'Email Settings', 'better-payment' ),
651 'condition' => [
652 'better_payment_form_email_enable' => 'yes'
653 ]
654 ]
655 );
656
657 $this->start_controls_tabs( 'better_payment_email_tabs' );
658
659 //Admin Email Notification
660 $this->start_controls_tab( 'better_payment_email_admin_tab', [
661 'label' => __( 'Admin', 'better-payment' ),
662 ] );
663
664 $this->add_control('better_payment_email_to', [
665 'label' => __('To', 'better-payment'),
666 'type' => Controls_Manager::TEXT,
667 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_to']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_to']) : esc_html(get_option('admin_email')),
668 'placeholder' => get_option('admin_email'),
669 'label_block' => true,
670 'title' => __('Email address to notify site admin after each successful transaction', 'better-payment'),
671 'render_type' => 'none'
672 ]);
673
674 $default_subject = !empty($this->better_payment_global_settings['better_payment_settings_general_email_subject']) ? esc_html__($this->better_payment_global_settings['better_payment_settings_general_email_subject'], 'better-payment') : sprintf(__('Better Payment transaction on %s', 'better-payment'), esc_html(get_option('blogname')));
675
676 $this->add_control('better_payment_email_subject', [
677 'label' => __('Subject', 'better-payment'),
678 'type' => Controls_Manager::TEXT,
679 'default' => esc_html($default_subject),
680 'placeholder' => esc_html($default_subject),
681 'label_block' => true,
682 'render_type' => 'none'
683 ]);
684
685 $this->add_control('better_payment_email_content', [
686 'label' => __('Message', 'better-payment'),
687 'type' => Controls_Manager::TEXTAREA,
688 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_message_admin']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_message_admin']) : '[bp-all-fields]',
689 'placeholder' => '[bp-all-fields]',
690 'render_type' => 'none'
691 ]);
692
693 $site_url_parsed = parse_url(get_site_url());
694 $better_domain = $site_url_parsed['host'] ? esc_html($site_url_parsed['host']) : 'example.com';
695
696 $this->add_control('better_payment_email_from', [
697 'label' => __('From email', 'better-payment'),
698 'type' => Controls_Manager::TEXT,
699 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_from_email']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_from_email']) : "wordpress@$better_domain",
700 'render_type' => 'none',
701 'separator' => 'before'
702 ]);
703
704 $this->add_control('better_payment_email_from_name', [
705 'label' => __('From name', 'better-payment'),
706 'type' => Controls_Manager::TEXT,
707 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_from_name']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_from_name']) : esc_html(get_bloginfo('name')),
708 'render_type' => 'none'
709 ]);
710
711 $this->add_control('better_payment_email_reply_to', [
712 'label' => __('Reply-To', 'better-payment'),
713 'type' => Controls_Manager::TEXT,
714 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_reply_to']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_reply_to']) : "wordpress@$better_domain",
715 'placeholder' => "wordpress@$better_domain",
716 'render_type' => 'none'
717 ]);
718
719 $this->add_control('better_payment_email_cc', [
720 'label' => __('Cc', 'better-payment'),
721 'type' => Controls_Manager::TEXT,
722 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_cc']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_cc']) : '',
723 'render_type' => 'none'
724 ]);
725
726 $this->add_control('better_payment_email_bcc', [
727 'label' => __('Bcc', 'better-payment'),
728 'type' => Controls_Manager::TEXT,
729 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_bcc']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_bcc']) : '',
730 'render_type' => 'none'
731 ]);
732
733 $this->add_control('better_payment_email_content_type', [
734 'label' => __('Send as', 'better-payment'),
735 'type' => Controls_Manager::SELECT,
736 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_send_as']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_send_as']) : 'html', //html or plain
737 'render_type' => 'none',
738 'options' => [
739 'html' => __('HTML', 'better-payment'),
740 'plain' => __('Plain', 'better-payment')
741 ]
742 ]);
743
744 $this->end_controls_tab();
745
746 //Customer Email Notification
747 $this->start_controls_tab( 'better_payment_email_customer_tab', [
748 'label' => __( 'Customer', 'better-payment' ),
749 ] );
750
751 $default_subject = !empty($this->better_payment_global_settings['better_payment_settings_general_email_subject_customer']) ? esc_html__($this->better_payment_global_settings['better_payment_settings_general_email_subject_customer'], 'better-payment') : sprintf(__('Better Payment transaction on %s', 'better-payment'), esc_html(get_option('blogname')));
752
753 $this->add_control('better_payment_email_subject_customer', [
754 'label' => __('Subject', 'better-payment'),
755 'type' => Controls_Manager::TEXT,
756 'default' => esc_html($default_subject),
757 'placeholder' => esc_html($default_subject),
758 'label_block' => true,
759 'render_type' => 'none'
760 ]);
761
762 $this->add_control('better_payment_email_content_customer', [
763 'label' => __('Message', 'better-payment'),
764 'type' => Controls_Manager::TEXTAREA,
765 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_message_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_message_customer']) : '[bp-all-fields]',
766 'placeholder' => '[bp-all-fields]',
767 'render_type' => 'none'
768 ]);
769
770 $site_url_parsed = parse_url(get_site_url());
771 $better_domain = $site_url_parsed['host'] ? esc_html($site_url_parsed['host']) : 'example.com';
772
773 $this->add_control('better_payment_email_from_customer', [
774 'label' => __('From email', 'better-payment'),
775 'type' => Controls_Manager::TEXT,
776 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_from_email_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_from_email_customer']) : "wordpress@$better_domain",
777 'render_type' => 'none',
778 'separator' => 'before'
779 ]);
780
781 $this->add_control('better_payment_email_from_name_customer', [
782 'label' => __('From name', 'better-payment'),
783 'type' => Controls_Manager::TEXT,
784 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_from_name_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_from_name_customer']) : get_bloginfo('name'),
785 'render_type' => 'none'
786 ]);
787
788 $this->add_control('better_payment_email_reply_to_customer', [
789 'label' => __('Reply-To', 'better-payment'),
790 'type' => Controls_Manager::TEXT,
791 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_reply_to_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_reply_to_customer']) : "wordpress@$better_domain",
792 'placeholder' => "wordpress@$better_domain",
793 'render_type' => 'none'
794 ]);
795
796 $this->add_control('better_payment_email_cc_customer', [
797 'label' => __('Cc', 'better-payment'),
798 'type' => Controls_Manager::TEXT,
799 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_cc_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_cc_customer']) : '',
800 'render_type' => 'none'
801 ]);
802
803 $this->add_control('better_payment_email_bcc_customer', [
804 'label' => __('Bcc', 'better-payment'),
805 'type' => Controls_Manager::TEXT,
806 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_bcc_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_bcc_customer']) : '',
807 'render_type' => 'none'
808 ]);
809
810 $this->add_control('better_payment_email_content_type_customer', [
811 'label' => __('Send as', 'better-payment'),
812 'type' => Controls_Manager::SELECT,
813 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_send_as_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_send_as_customer']) : 'html', //html or plain
814 'render_type' => 'none',
815 'options' => [
816 'html' => __('HTML', 'better-payment'),
817 'plain' => __('Plain', 'better-payment')
818 ]
819 ]);
820
821 $this->end_controls_tab();
822
823 $this->end_controls_tabs();
824
825 $this->end_controls_section();
826 }
827
828 public function success_message_setting() {
829 $this->start_controls_section(
830 'better_payment_form_success_message_settings',
831 [
832 'label' => esc_html__( 'Success Message', 'better-payment' ),
833 'conditions' => [
834 'relation' => 'or',
835 'terms' => [
836 [
837 'name' => 'better_payment_form_stripe_enable',
838 'value' => 'yes',
839 ],
840 [
841 'name' => 'better_payment_form_paypal_enable',
842 'value' => 'yes',
843 ],
844 ],
845 ]
846 ]
847 );
848
849 $this->add_control(
850 'better_payment_form_success_message_icon',
851 [
852 'label' => esc_html__( 'Icon', 'better-payment' ),
853 'type' => Controls_Manager::ICONS,
854
855 ]
856 );
857
858 $this->add_control(
859 'better_payment_form_success_message_heading',
860 [
861 'label' => __( 'Heading Message Text', 'better-payment' ),
862 'type' => Controls_Manager::TEXT,
863 'default' => __( 'Payment Successful', 'better-payment' ),
864 'dynamic' => [
865 'active' => true,
866 ],
867 'label_block' => true
868 ]
869 );
870
871 $this->add_control(
872 'better_payment_form_success_message_transaction',
873 [
874 'label' => __( 'Transaction Text', 'better-payment' ),
875 'type' => Controls_Manager::TEXT,
876 'default' => __( 'Transaction Number', 'better-payment' ),
877 'dynamic' => [
878 'active' => true,
879 ],
880 'label_block' => true
881 ]
882 );
883
884 $this->add_control(
885 'better_payment_form_success_message_thanks',
886 [
887 'label' => __( 'Thanks Text', 'better-payment' ),
888 'type' => Controls_Manager::TEXT,
889 'default' => __( 'Thank you for your payment', 'better-payment' ),
890 'dynamic' => [
891 'active' => true,
892 ],
893 'label_block' => true
894 ]
895 );
896
897 $this->end_controls_section();
898 }
899
900 public function error_message_setting() {
901 $this->start_controls_section(
902 'better_payment_form_error_message_settings',
903 [
904 'label' => esc_html__( 'Error Message', 'better-payment' ),
905 'conditions' => [
906 'relation' => 'or',
907 'terms' => [
908 [
909 'name' => 'better_payment_form_stripe_enable',
910 'value' => 'yes',
911 ],
912 [
913 'name' => 'better_payment_form_paypal_enable',
914 'value' => 'yes',
915 ],
916 ],
917 ]
918 ]
919 );
920
921 $this->add_control(
922 'better_payment_form_error_message_icon',
923 [
924 'label' => esc_html__( 'Icon', 'better-payment' ),
925 'type' => Controls_Manager::ICONS,
926
927 ]
928 );
929
930 $this->add_control(
931 'better_payment_form_error_message_heading',
932 [
933 'label' => __( 'Heading Message Text', 'better-payment' ),
934 'type' => Controls_Manager::TEXT,
935 'default' => __( 'Payment Failed', 'better-payment' ),
936 'dynamic' => [
937 'active' => true,
938 ],
939 'label_block' => true
940 ]
941 );
942
943 $this->end_controls_section();
944 }
945
946 public function form_style() {
947
948 // $this->header_form_container();
949
950 // $this->form_container();
951
952 // $this->input_style();
953
954 // $this->amount_field_style();
955
956 // $this->placeholder_style();
957
958 // $this->paypal_button_style();
959
960 // $this->stripe_button();
961
962 // $this->success_message_style();
963
964 // $this->error_message_style();
965
966 $this->form_sidebar_style();
967 $this->form_sidebar_text_style();
968 $this->form_container_style();
969 $this->form_fields_style();
970 $this->form_fields_amount_style();
971 $this->form_button_style();
972
973 }
974
975 public function form_sidebar_style() {
976 $this->start_controls_section(
977 'better_payment_form_sidebar_style',
978 [
979 'label' => esc_html__( 'Form Sidebar Style', 'better-payment' ),
980 'tab' => Controls_Manager::TAB_STYLE,
981 ]
982 );
983
984 $this->add_group_control(
985 Group_Control_Background::get_type(),
986 [
987 'name' => 'better_payment_form_sidebar_background',
988 // 'label' => __( 'Background', 'better-payment' ),
989 'types' => [ 'classic', 'gradient' ],
990 'selector' => '{{WRAPPER}} .better-payment .dynamic-amount-section',
991 ]
992 );
993
994 $this->add_responsive_control(
995 'better_payment_form_sidebar_margin',
996 [
997 'label' => esc_html__( 'Margin', 'better-payment' ),
998 'type' => Controls_Manager::DIMENSIONS,
999 'size_units' => [ 'px', 'em', '%' ],
1000 'selectors' => [
1001 '{{WRAPPER}} .better-payment .dynamic-amount-section' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1002 ],
1003 'separator' => 'before',
1004 ]
1005 );
1006
1007 $this->add_responsive_control(
1008 'better_payment_form_sidebar_padding',
1009 [
1010 'label' => esc_html__( 'Padding', 'better-payment' ),
1011 'type' => Controls_Manager::DIMENSIONS,
1012 'size_units' => [ 'px', 'em', '%' ],
1013 'selectors' => [
1014 '{{WRAPPER}} .better-payment .dynamic-amount-section-inner.p-6' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1015 ],
1016 ]
1017 );
1018
1019 $this->add_control(
1020 'better_payment_form_sidebar_border_radius',
1021 [
1022 'label' => esc_html__( 'Border Radius', 'better-payment' ),
1023 'type' => Controls_Manager::DIMENSIONS,
1024 'separator' => 'before',
1025 'size_units' => [ 'px' ],
1026 'selectors' => [
1027 '{{WRAPPER}} .better-payment .dynamic-amount-section' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1028 ],
1029 ]
1030 );
1031
1032 $this->add_group_control(
1033 Group_Control_Border::get_type(),
1034 [
1035 'name' => 'better_payment_form_sidebar_border',
1036 'selector' => '{{WRAPPER}} .better-payment .dynamic-amount-section',
1037 ]
1038 );
1039
1040 $this->add_group_control(
1041 Group_Control_Box_Shadow::get_type(),
1042 [
1043 'name' => 'better_payment_form_sidebar_box_shadow',
1044 'selector' => '{{WRAPPER}} .better-payment .dynamic-amount-section',
1045 ]
1046 );
1047
1048 $this->end_controls_section();
1049 }
1050
1051 public function form_sidebar_text_style() {
1052 $this->start_controls_section(
1053 'better_payment_form_sidebar_text_style',
1054 [
1055 'label' => esc_html__( 'Sidebar Text Style', 'better-payment' ),
1056 'tab' => Controls_Manager::TAB_STYLE,
1057 ]
1058 );
1059
1060 $this->add_control(
1061 'better_payment_form_sidebar_text_title_style',
1062 [
1063 'label' => __( 'Title Text', 'better-payment' ),
1064 'type' => Controls_Manager::HEADING,
1065 ]
1066 );
1067
1068 $this->add_control(
1069 'better_payment_form_sidebar_text_title_color',
1070 [
1071 'label' => __( 'Color', 'better-payment' ),
1072 'type' => Controls_Manager::COLOR,
1073 'default' => '',
1074 'selectors' => [
1075 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-title' => 'color: {{VALUE}}',
1076 ],
1077 ]
1078 );
1079
1080 $this->add_group_control(
1081 Group_Control_Typography::get_type(),
1082 [
1083 'name' => 'better_payment_form_sidebar_text_title_typography',
1084 'label' => __( 'Typography', 'better-payment' ),
1085 'scheme' => Typography::TYPOGRAPHY_4,
1086 'selector' => '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-title',
1087 'separator' => 'after',
1088 ]
1089 );
1090
1091 $this->add_responsive_control(
1092 'better_payment_form_sidebar_text_title_margin',
1093 [
1094 'label' => esc_html__( 'Margin', 'better-payment' ),
1095 'type' => Controls_Manager::DIMENSIONS,
1096 'size_units' => [ 'px', 'em', '%' ],
1097 'selectors' => [
1098 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1099 ],
1100 ]
1101 );
1102
1103 $this->add_responsive_control(
1104 'better_payment_form_sidebar_text_title_padding',
1105 [
1106 'label' => esc_html__( 'Padding', 'better-payment' ),
1107 'type' => Controls_Manager::DIMENSIONS,
1108 'size_units' => [ 'px', 'em', '%' ],
1109 'selectors' => [
1110 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1111 ],
1112 ]
1113 );
1114
1115 $this->add_control(
1116 'better_payment_form_sidebar_text_sub_title_style',
1117 [
1118 'label' => __( 'Sub-Title Text', 'better-payment' ),
1119 'type' => Controls_Manager::HEADING,
1120 'separator' => 'before',
1121 ],
1122 );
1123
1124 $this->add_control(
1125 'better_payment_form_sidebar_text_sub_title_color',
1126 [
1127 'label' => __( 'Color', 'better-payment' ),
1128 'type' => Controls_Manager::COLOR,
1129 'default' => '',
1130 'selectors' => [
1131 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-sub-title' => 'color: {{VALUE}}',
1132 ],
1133 ]
1134 );
1135
1136 $this->add_group_control(
1137 Group_Control_Typography::get_type(),
1138 [
1139 'name' => 'better_payment_form_sidebar_text_sub_title_typography',
1140 'label' => __( 'Typography', 'better-payment' ),
1141 'scheme' => Typography::TYPOGRAPHY_4,
1142 'selector' => '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-sub-title',
1143 ]
1144 );
1145
1146 $this->add_responsive_control(
1147 'better_payment_form_sidebar_text_sub_title_margin',
1148 [
1149 'label' => esc_html__( 'Margin', 'better-payment' ),
1150 'type' => Controls_Manager::DIMENSIONS,
1151 'size_units' => [ 'px', 'em', '%' ],
1152 'selectors' => [
1153 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-sub-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1154 ],
1155 ]
1156 );
1157
1158 $this->add_responsive_control(
1159 'better_payment_form_sidebar_text_sub_title_padding',
1160 [
1161 'label' => esc_html__( 'Padding', 'better-payment' ),
1162 'type' => Controls_Manager::DIMENSIONS,
1163 'size_units' => [ 'px', 'em', '%' ],
1164 'selectors' => [
1165 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-sub-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1166 ],
1167 ]
1168 );
1169
1170 $this->add_control(
1171 'better_payment_form_sidebar_text_amount_style',
1172 [
1173 'label' => __( 'Amount Text', 'better-payment' ),
1174 'type' => Controls_Manager::HEADING,
1175 'separator' => 'before',
1176 ],
1177 );
1178
1179 $this->add_control(
1180 'better_payment_form_sidebar_text_amount_title_color',
1181 [
1182 'label' => __( 'Color', 'better-payment' ),
1183 'type' => Controls_Manager::COLOR,
1184 'default' => '',
1185 'selectors' => [
1186 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount' => 'color: {{VALUE}}',
1187 ],
1188 ]
1189 );
1190
1191 $this->add_group_control(
1192 Group_Control_Typography::get_type(),
1193 [
1194 'name' => 'better_payment_form_sidebar_text_amount_typography',
1195 'label' => __( 'Typography', 'better-payment' ),
1196 'scheme' => Typography::TYPOGRAPHY_4,
1197 'selector' => '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount',
1198 ]
1199 );
1200
1201 $this->add_responsive_control(
1202 'better_payment_form_sidebar_text_amount_margin',
1203 [
1204 'label' => esc_html__( 'Margin', 'better-payment' ),
1205 'type' => Controls_Manager::DIMENSIONS,
1206 'size_units' => [ 'px', 'em', '%' ],
1207 'selectors' => [
1208 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1209 ],
1210 ]
1211 );
1212
1213 $this->add_responsive_control(
1214 'better_payment_form_sidebar_text_amount_padding',
1215 [
1216 'label' => esc_html__( 'Padding', 'better-payment' ),
1217 'type' => Controls_Manager::DIMENSIONS,
1218 'size_units' => [ 'px', 'em', '%' ],
1219 'selectors' => [
1220 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1221 ],
1222 ]
1223 );
1224
1225 $this->add_control(
1226 'better_payment_form_sidebar_text_amount_summary_style',
1227 [
1228 'label' => __( 'Amount Summary', 'better-payment' ),
1229 'type' => Controls_Manager::HEADING,
1230 'separator' => 'before',
1231 ],
1232 );
1233
1234 $this->add_control(
1235 'better_payment_form_sidebar_text_amount_summary_color',
1236 [
1237 'label' => __( 'Color', 'better-payment' ),
1238 'type' => Controls_Manager::COLOR,
1239 'default' => '',
1240 'selectors' => [
1241 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount-summary' => 'color: {{VALUE}}',
1242 ],
1243 ]
1244 );
1245
1246 $this->add_group_control(
1247 Group_Control_Typography::get_type(),
1248 [
1249 'name' => 'better_payment_form_sidebar_text_amount_summary_typography',
1250 'label' => __( 'Typography', 'better-payment' ),
1251 'scheme' => Typography::TYPOGRAPHY_4,
1252 'selector' => '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount-summary',
1253 ]
1254 );
1255
1256 $this->add_responsive_control(
1257 'better_payment_form_sidebar_text_amount_summary_margin',
1258 [
1259 'label' => esc_html__( 'Margin', 'better-payment' ),
1260 'type' => Controls_Manager::DIMENSIONS,
1261 'size_units' => [ 'px', 'em', '%' ],
1262 'selectors' => [
1263 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount-summary' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1264 ],
1265 ]
1266 );
1267
1268 $this->add_responsive_control(
1269 'better_payment_form_sidebar_text_amount_summary_padding',
1270 [
1271 'label' => esc_html__( 'Padding', 'better-payment' ),
1272 'type' => Controls_Manager::DIMENSIONS,
1273 'size_units' => [ 'px', 'em', '%' ],
1274 'selectors' => [
1275 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount-summary' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1276 ],
1277 ]
1278 );
1279
1280 $this->add_control(
1281 'better_payment_form_sidebar_text_icon_style',
1282 [
1283 'label' => __( 'Icon', 'better-payment' ),
1284 'type' => Controls_Manager::HEADING,
1285 'separator' => 'before',
1286 ],
1287 );
1288
1289 // $this->add_control(
1290 // 'better_payment_form_sidebar_text_icon_image',
1291 // [
1292 // 'label' => esc_html__( 'Icon', 'better-payment' ),
1293 // 'type' => Controls_Manager::ICONS,
1294 // 'condition' => [
1295 // 'better_payment_form_layout' => 'layout-2',
1296 // 'better_payment_form_layout' => 'layout-3',
1297 // ],
1298
1299 // ]
1300 // );
1301
1302 $this->add_control(
1303 'better_payment_form_sidebar_text_icon_color',
1304 [
1305 'label' => __( 'Color', 'better-payment' ),
1306 'type' => Controls_Manager::COLOR,
1307 'default' => '',
1308 'selectors' => [
1309 '{{WRAPPER}} .bp-dynamic-amount-section-icon:before' => 'color: {{VALUE}}',
1310 ],
1311 'condition' => [
1312 'better_payment_form_layout!' => 'layout-1',
1313 ],
1314 ]
1315 );
1316
1317 $this->add_responsive_control(
1318 'better_payment_form_sidebar_text_icon_font_size',
1319 [
1320 'label' => esc_html__( 'Font Size', 'better-payment' ),
1321 'type' => Controls_Manager::SLIDER,
1322 'size_units' => [ 'px', 'em', '%' ],
1323 'range' => [
1324 'px' => [
1325 'min' => 10,
1326 'max' => 100,
1327 ],
1328 'em' => [
1329 'min' => 1,
1330 'max' => 50,
1331 ],
1332 ],
1333 'selectors' => [
1334 '{{WRAPPER}} .bp-dynamic-amount-section-icon:before' => 'font-size: {{SIZE}}{{UNIT}};',
1335 ],
1336 'condition' => [
1337 'better_payment_form_layout!' => 'layout-1',
1338 ],
1339 ]
1340 );
1341
1342 $this->add_responsive_control(
1343 'better_payment_form_sidebar_text_icon_margin',
1344 [
1345 'label' => esc_html__( 'Margin', 'better-payment' ),
1346 'type' => Controls_Manager::DIMENSIONS,
1347 'size_units' => [ 'px', 'em', '%' ],
1348 'selectors' => [
1349 '{{WRAPPER}} .bp-dynamic-amount-section-icon-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1350 ],
1351 'condition' => [
1352 'better_payment_form_layout!' => 'layout-1',
1353 ],
1354 ]
1355 );
1356
1357 $this->add_responsive_control(
1358 'better_payment_form_sidebar_text_icon_padding',
1359 [
1360 'label' => esc_html__( 'Padding', 'better-payment' ),
1361 'type' => Controls_Manager::DIMENSIONS,
1362 'size_units' => [ 'px', 'em', '%' ],
1363 'selectors' => [
1364 '{{WRAPPER}} .bp-dynamic-amount-section-icon-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1365 ],
1366 'condition' => [
1367 'better_payment_form_layout!' => 'layout-1',
1368 ],
1369 ]
1370 );
1371
1372 $this->end_controls_section();
1373 }
1374
1375 public function form_container_style() {
1376 $this->start_controls_section(
1377 'better_payment_form_container_style',
1378 [
1379 'label' => esc_html__( 'Form Container Style', 'better-payment' ),
1380 'tab' => Controls_Manager::TAB_STYLE,
1381 ]
1382 );
1383
1384 $this->add_group_control(
1385 Group_Control_Background::get_type(),
1386 [
1387 'name' => 'better_payment_form_container_background',
1388 // 'label' => __( 'Background', 'better-payment' ),
1389 'types' => [ 'classic', 'gradient' ],
1390 'selector' => '{{WRAPPER}} .better-payment .form-content-section',
1391 ]
1392 );
1393
1394 $this->add_responsive_control(
1395 'better_payment_form_container_margin',
1396 [
1397 'label' => esc_html__( 'Margin', 'better-payment' ),
1398 'type' => Controls_Manager::DIMENSIONS,
1399 'size_units' => [ 'px', 'em', '%' ],
1400 'selectors' => [
1401 '{{WRAPPER}} .better-payment .form-content-section' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1402 ],
1403 ]
1404 );
1405
1406 $this->add_responsive_control(
1407 'better_payment_form_container_padding',
1408 [
1409 'label' => esc_html__( 'Padding', 'better-payment' ),
1410 'type' => Controls_Manager::DIMENSIONS,
1411 'size_units' => [ 'px', 'em', '%' ],
1412 'selectors' => [
1413 '{{WRAPPER}} .better-payment .form-content-section-inner.p-6' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1414 ],
1415 ]
1416 );
1417
1418 $this->add_control(
1419 'better_payment_form_container_border_radius',
1420 [
1421 'label' => esc_html__( 'Border Radius', 'better-payment' ),
1422 'type' => Controls_Manager::DIMENSIONS,
1423 'separator' => 'before',
1424 'size_units' => [ 'px' ],
1425 'selectors' => [
1426 '{{WRAPPER}} .better-payment .form-content-section' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1427 ],
1428 ]
1429 );
1430
1431 $this->add_group_control(
1432 Group_Control_Border::get_type(),
1433 [
1434 'name' => 'better_payment_form_container_border',
1435 'selector' => '{{WRAPPER}} .better-payment .form-content-section',
1436 ]
1437 );
1438
1439 $this->add_group_control(
1440 Group_Control_Box_Shadow::get_type(),
1441 [
1442 'name' => 'better_payment_form_container_box_shadow',
1443 'selector' => '{{WRAPPER}} .better-payment .form-content-section',
1444 ]
1445 );
1446
1447 $this->end_controls_section();
1448 }
1449
1450 public function form_fields_style() {
1451 $this->start_controls_section(
1452 'better_payment_form_fields_style',
1453 [
1454 'label' => esc_html__( 'Form Fields Style', 'better-payment' ),
1455 'tab' => Controls_Manager::TAB_STYLE,
1456 ]
1457 );
1458
1459 $this->add_control(
1460 'better_payment_form_fields_input_bg',
1461 [
1462 'label' => __( 'Background Color', 'better-payment' ),
1463 'type' => Controls_Manager::COLOR,
1464 'default' => '',
1465 'selectors' => [
1466 '{{WRAPPER}} .better-payment .form-content-section input' => 'background-color: {{VALUE}}',
1467 ],
1468 ]
1469 );
1470
1471 $this->add_control(
1472 'better_payment_form_fields_input_text_color',
1473 [
1474 'label' => __( 'Text Color', 'better-payment' ),
1475 'type' => Controls_Manager::COLOR,
1476 'default' => '',
1477 'selectors' => [
1478 '{{WRAPPER}} .better-payment .form-content-section input' => 'color: {{VALUE}}',
1479 '{{WRAPPER}} .better-payment .form-content-section .payment-method-checkbox' => 'color: {{VALUE}}',
1480 ],
1481 ]
1482 );
1483
1484 $this->add_control(
1485 'better_payment_form_fields_input_placeholder_color',
1486 [
1487 'label' => __( 'Placeholder Color', 'better-payment' ),
1488 'type' => Controls_Manager::COLOR,
1489 'default' => '',
1490 'selectors' => [
1491 '{{WRAPPER}} .better-payment .form-content-section input::placeholder' => 'color: {{VALUE}}',
1492 ],
1493 ]
1494 );
1495
1496 $this->add_responsive_control(
1497 'better_payment_form_fields_input_spacing',
1498 [
1499 'label' => __( 'Spacing', 'better-payment' ),
1500 'type' => Controls_Manager::SLIDER,
1501 'default' => [
1502 'size' => '0',
1503 'unit' => 'px',
1504 ],
1505 'range' => [
1506 'px' => [
1507 'min' => 0,
1508 'max' => 100,
1509 'step' => 1,
1510 ],
1511 ],
1512 'size_units' => [ 'px', 'em', '%' ],
1513 'selectors' => [
1514 '{{WRAPPER}} .better-payment .form-content-section input' => 'margin-bottom: {{SIZE}}{{UNIT}}',
1515 ],
1516 ]
1517 );
1518
1519 $this->add_responsive_control(
1520 'better_payment_form_fields_input_padding',
1521 [
1522 'label' => __( 'Padding', 'better-payment' ),
1523 'type' => Controls_Manager::DIMENSIONS,
1524 'size_units' => [ 'px', 'em', '%' ],
1525 'selectors' => [
1526 '{{WRAPPER}} .better-payment .form-content-section input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1527 ],
1528 ]
1529 );
1530
1531 $this->add_responsive_control(
1532 'better_payment_form_fields_input_text_indent',
1533 [
1534 'label' => __( 'Text Indent', 'better-payment' ),
1535 'type' => Controls_Manager::SLIDER,
1536 'range' => [
1537 'px' => [
1538 'min' => 0,
1539 'max' => 60,
1540 'step' => 1,
1541 ],
1542 '%' => [
1543 'min' => 0,
1544 'max' => 30,
1545 'step' => 1,
1546 ],
1547 ],
1548 'size_units' => [ 'px', 'em', '%' ],
1549 'selectors' => [
1550 '{{WRAPPER}} .form-content-section input' => 'text-indent: {{SIZE}}{{UNIT}}',
1551 ],
1552 ]
1553 );
1554
1555 $this->add_responsive_control(
1556 'better_payment_form_fields_input_width',
1557 [
1558 'label' => __( 'Input Width', 'better-payment' ),
1559 'type' => Controls_Manager::SLIDER,
1560 'range' => [
1561 'px' => [
1562 'min' => 0,
1563 'max' => 1200,
1564 'step' => 1,
1565 ],
1566 ],
1567 'size_units' => [ 'px', 'em', '%' ],
1568 'description' => __( 'Set width for all input fields. Not applicable if the field is set to display inline (<b>Content => Form Settings => Form Fields (Repeater) => Display Inline?</b>)', 'better-payment' ),
1569 'selectors' => [
1570 '{{WRAPPER}} .better-payment .form-content-section input[type="text"]' => 'width: {{SIZE}}{{UNIT}}',
1571 '{{WRAPPER}} .better-payment .form-content-section input[type="email"]' => 'width: {{SIZE}}{{UNIT}}',
1572 '{{WRAPPER}} .better-payment .form-content-section input[type="number"]' => 'width: {{SIZE}}{{UNIT}}',
1573 ],
1574 ]
1575 );
1576
1577 $this->add_responsive_control(
1578 'better_payment_form_fields_input_height',
1579 [
1580 'label' => __( 'Input Height', 'better-payment' ),
1581 'type' => Controls_Manager::SLIDER,
1582 'range' => [
1583 'px' => [
1584 'min' => 0,
1585 'max' => 1200,
1586 'step' => 1,
1587 ],
1588 ],
1589 'size_units' => [ 'px', 'em', '%' ],
1590 'selectors' => [
1591 '{{WRAPPER}} .better-payment .form-content-section input[type="text"]' => 'height: {{SIZE}}{{UNIT}}',
1592 '{{WRAPPER}} .better-payment .form-content-section input[type="email"]' => 'height: {{SIZE}}{{UNIT}}',
1593 '{{WRAPPER}} .better-payment .form-content-section input[type="number"]' => 'height: {{SIZE}}{{UNIT}}',
1594 ],
1595 ]
1596 );
1597
1598 $this->add_group_control(
1599 Group_Control_Border::get_type(),
1600 [
1601 'name' => 'better_payment_form_fields_input_border',
1602 'label' => __( 'Border', 'better-payment' ),
1603 'placeholder' => '1px',
1604 'default' => '1px',
1605 'selector' => '{{WRAPPER}} .better-payment .form-content-section input',
1606 ]
1607 );
1608
1609 $this->add_control(
1610 'better_payment_form_fields_input_radius',
1611 [
1612 'label' => __( 'Border Radius', 'better-payment' ),
1613 'type' => Controls_Manager::DIMENSIONS,
1614 'size_units' => [ 'px', 'em', '%' ],
1615 'selectors' => [
1616 '{{WRAPPER}} .better-payment .form-content-section input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1617 ],
1618 'separator' => 'after',
1619 ]
1620 );
1621
1622 $this->add_group_control(
1623 Group_Control_Typography::get_type(),
1624 [
1625 'name' => 'better_payment_form_fields_input_typography',
1626 'label' => __( 'Typography', 'better-payment' ),
1627 'scheme' => Typography::TYPOGRAPHY_4,
1628 'selector' => '{{WRAPPER}} .better-payment .form-content-section input',
1629 ]
1630 );
1631
1632 $this->add_group_control(
1633 Group_Control_Box_Shadow::get_type(),
1634 [
1635 'name' => 'better_payment_form_fields_input_box_shadow',
1636 'selector' => '{{WRAPPER}} .better-payment .form-content-section input',
1637 ]
1638 );
1639
1640 $this->end_controls_section();
1641 }
1642
1643 public function form_fields_amount_style() {
1644
1645 $this->start_controls_section(
1646 'better_payment_form_fields_amount_style',
1647 [
1648 'label' => __( 'Amount Fields Style', 'better-payment' ),
1649 'tab' => Controls_Manager::TAB_STYLE,
1650 ]
1651 );
1652
1653 $this->add_responsive_control(
1654 'better_payment_form_fields_amount_width',
1655 [
1656 'label' => __( 'Input Width', 'better-payment' ),
1657 'type' => Controls_Manager::SLIDER,
1658 'default' => [
1659 'size' => '150',
1660 'unit' => 'px',
1661 ],
1662 'range' => [
1663 'px' => [
1664 'min' => 0,
1665 'max' => 1200,
1666 'step' => 1,
1667 ],
1668 ],
1669 'size_units' => [ 'px', 'em', '%' ],
1670 'selectors' => [
1671 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'width: {{SIZE}}{{UNIT}}',
1672 ],
1673 ]
1674 );
1675
1676 $this->add_responsive_control(
1677 'better_payment_form_fields_amount_height',
1678 [
1679 'label' => __( 'Input Height', 'better-payment' ),
1680 'type' => Controls_Manager::SLIDER,
1681 'range' => [
1682 'px' => [
1683 'min' => 0,
1684 'max' => 1200,
1685 'step' => 1,
1686 ],
1687 ],
1688 'size_units' => [ 'px', 'em', '%' ],
1689 'selectors' => [
1690 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'height: {{SIZE}}{{UNIT}}',
1691 ],
1692 ]
1693 );
1694
1695 $this->add_responsive_control(
1696 'better_payment_form_fields_amount_spacing',
1697 [
1698 'label' => __( 'Spacing', 'better-payment' ),
1699 'type' => Controls_Manager::SLIDER,
1700 'default' => [
1701 'size' => '0',
1702 'unit' => 'px',
1703 ],
1704 'range' => [
1705 'px' => [
1706 'min' => 0,
1707 'max' => 100,
1708 'step' => 1,
1709 ],
1710 ],
1711 'size_units' => [ 'px', 'em', '%' ],
1712 'selectors' => [
1713 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'margin-bottom: {{SIZE}}{{UNIT}}',
1714 ],
1715 ]
1716 );
1717
1718 $this->start_controls_tabs( 'better_payment_form_amount_tabs_button_style' );
1719
1720 $this->start_controls_tab(
1721 'better_payment_form_fields_amount_normal',
1722 [
1723 'label' => __( 'Normal', 'better-payment' ),
1724 ]
1725 );
1726
1727 $this->add_control(
1728 'better_payment_form_fields_amount_normal_bg',
1729 [
1730 'label' => __( 'Background Color', 'better-payment' ),
1731 'type' => Controls_Manager::COLOR,
1732 'default' => '',
1733 'selectors' => [
1734 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'background-color: {{VALUE}}',
1735 ],
1736 ]
1737 );
1738
1739 $this->add_control(
1740 'better_payment_form_fields_amount_normal_text_color',
1741 [
1742 'label' => __( 'Text Color', 'better-payment' ),
1743 'type' => Controls_Manager::COLOR,
1744 'default' => '',
1745 'selectors' => [
1746 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'color: {{VALUE}}',
1747 ],
1748 ]
1749 );
1750
1751 $this->end_controls_tab();
1752
1753 $this->start_controls_tab(
1754 'better_payment_form_fields_amount_selected',
1755 [
1756 'label' => __( 'Selected', 'better-payment' ),
1757 ]
1758 );
1759
1760 $this->add_control(
1761 'better_payment_form_fields_amount_selected_bg',
1762 [
1763 'label' => __( 'Background Color', 'better-payment' ),
1764 'type' => Controls_Manager::COLOR,
1765 'default' => '',
1766 'selectors' => [
1767 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type="radio"].bp-form__control:checked ~ label' => 'background-color: {{VALUE}}',
1768 ],
1769 ]
1770 );
1771
1772 $this->add_control(
1773 'better_payment_form_fields_amount_selected_text_color',
1774 [
1775 'label' => __( 'Text Color', 'better-payment' ),
1776 'type' => Controls_Manager::COLOR,
1777 'default' => '',
1778 'selectors' => [
1779 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type="radio"].bp-form__control:checked ~ label' => 'color: {{VALUE}}',
1780 ]
1781 ]
1782 );
1783
1784 $this->end_controls_tab();
1785
1786 $this->end_controls_tabs();
1787
1788 $this->add_group_control(
1789 Group_Control_Border::get_type(),
1790 [
1791 'name' => 'better_payment_form_fields_amount_border',
1792 'label' => __( 'Border', 'better-payment' ),
1793 'placeholder' => '1px',
1794 'default' => '1px',
1795 'selector' => '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label',
1796 'separator' => 'before',
1797 ]
1798 );
1799
1800 $this->add_control(
1801 'better_payment_form_fields_amount_border_radius',
1802 [
1803 'label' => __( 'Border Radius', 'better-payment' ),
1804 'type' => Controls_Manager::DIMENSIONS,
1805 'size_units' => [ 'px', 'em', '%' ],
1806 'selectors' => [
1807 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1808 ],
1809 ]
1810 );
1811
1812 $this->add_group_control(
1813 Group_Control_Typography::get_type(),
1814 [
1815 'name' => 'better_payment_form_fields_amount_typography',
1816 'label' => __( 'Typography', 'better-payment' ),
1817 'scheme' => Typography::TYPOGRAPHY_4,
1818 'selector' => '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label',
1819 'separator' => 'before',
1820 ]
1821 );
1822
1823 $this->add_group_control(
1824 Group_Control_Box_Shadow::get_type(),
1825 [
1826 'name' => 'better_payment_form_fields_amount_box_shadow',
1827 'selector' => '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label',
1828 ]
1829 );
1830
1831 $this->end_controls_section();
1832 }
1833
1834 public function form_button_style() {
1835 $this->start_controls_section(
1836 'better_payment_form_button_style',
1837 [
1838 'label' => __( 'Form Button Style', 'better-payment' ),
1839 'tab' => Controls_Manager::TAB_STYLE,
1840 ]
1841 );
1842
1843 $this->add_responsive_control(
1844 'better_payment_form_button_width',
1845 [
1846 'label' => __( 'Width', 'better-payment' ),
1847 'type' => Controls_Manager::SLIDER,
1848 'range' => [
1849 'px' => [
1850 'min' => 0,
1851 'max' => 700,
1852 'step' => 1,
1853 ],
1854 ],
1855 'size_units' => [ 'px', 'em', '%' ],
1856 'selectors' => [
1857 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'flex: none;width: {{SIZE}}{{UNIT}}',
1858 ],
1859 ]
1860 );
1861
1862 $this->start_controls_tabs( 'better_payment_form_button_tabs_style' );
1863
1864 $this->start_controls_tab(
1865 'better_payment_form_button_normal',
1866 [
1867 'label' => __( 'Normal', 'better-payment' ),
1868 ]
1869 );
1870
1871 $this->add_control(
1872 'better_payment_form_button_normal_bg',
1873 [
1874 'label' => __( 'Background Color', 'better-payment' ),
1875 'type' => Controls_Manager::COLOR,
1876 'default' => '',
1877 'selectors' => [
1878 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'background-color: {{VALUE}} !important',
1879 ],
1880 ]
1881 );
1882
1883 $this->add_control(
1884 'better_payment_form_button_normal_text_color',
1885 [
1886 'label' => __( 'Text Color', 'better-payment' ),
1887 'type' => Controls_Manager::COLOR,
1888 'default' => '',
1889 'selectors' => [
1890 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'color: {{VALUE}} !important',
1891 ],
1892 ]
1893 );
1894
1895 $this->add_group_control(
1896 Group_Control_Border::get_type(),
1897 [
1898 'name' => 'better_payment_form_button_normal_border',
1899 'label' => __( 'Border', 'better-payment' ),
1900 'default' => '1px',
1901 'selector' => '{{WRAPPER}} .better-payment .payment-form-layout .button',
1902 ]
1903 );
1904
1905 $this->add_control(
1906 'better_payment_form_button_normal_border_radius',
1907 [
1908 'label' => __( 'Border Radius', 'better-payment' ),
1909 'type' => Controls_Manager::DIMENSIONS,
1910 'size_units' => [ 'px', 'em', '%' ],
1911 'selectors' => [
1912 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1913 ],
1914 ]
1915 );
1916
1917 $this->add_responsive_control(
1918 'better_payment_form_button_normal_padding',
1919 [
1920 'label' => __( 'Padding', 'better-payment' ),
1921 'type' => Controls_Manager::DIMENSIONS,
1922 'size_units' => [ 'px', 'em', '%' ],
1923 'selectors' => [
1924 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1925 ],
1926 ]
1927 );
1928
1929 $this->add_responsive_control(
1930 'better_payment_form_button_normal_margin',
1931 [
1932 'label' => __( 'Margin Top', 'better-payment' ),
1933 'type' => Controls_Manager::SLIDER,
1934 'range' => [
1935 'px' => [
1936 'min' => 0,
1937 'max' => 100,
1938 'step' => 1,
1939 ],
1940 ],
1941 'size_units' => [ 'px', 'em', '%' ],
1942 'selectors' => [
1943 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'margin-top: {{SIZE}}{{UNIT}}',
1944 ],
1945 ]
1946 );
1947
1948 $this->add_group_control(
1949 Group_Control_Typography::get_type(),
1950 [
1951 'name' => 'better_payment_form_button_normal_typography',
1952 'label' => __( 'Typography', 'better-payment' ),
1953 'scheme' => Typography::TYPOGRAPHY_4,
1954 'selector' => '{{WRAPPER}} .better-payment .payment-form-layout .button',
1955 'separator' => 'before',
1956 ]
1957 );
1958
1959 $this->add_group_control(
1960 Group_Control_Box_Shadow::get_type(),
1961 [
1962 'name' => 'better_payment_form_button_normal_box_shadow',
1963 'selector' => '{{WRAPPER}} .better-payment .payment-form-layout .button',
1964 ]
1965 );
1966
1967 $this->end_controls_tab();
1968
1969 $this->start_controls_tab(
1970 'better_payment_form_button_hover',
1971 [
1972 'label' => __( 'Hover', 'better-payment' ),
1973 ]
1974 );
1975
1976 $this->add_control(
1977 'better_payment_form_button_hover_bg',
1978 [
1979 'label' => __( 'Background Color', 'better-payment' ),
1980 'type' => Controls_Manager::COLOR,
1981 'default' => '',
1982 'selectors' => [
1983 '{{WRAPPER}} .better-payment .payment-form-layout .button:hover' => 'background-color: {{VALUE}} !important',
1984 '{{WRAPPER}} .better-payment .payment-form-layout.payment-form-layout-3 .button:hover' => 'background-color: {{VALUE}} !important',
1985 ],
1986 ]
1987 );
1988
1989 $this->add_control(
1990 'better_payment_form_button_hover_text_color',
1991 [
1992 'label' => __( 'Text Color', 'better-payment' ),
1993 'type' => Controls_Manager::COLOR,
1994 'default' => '',
1995 'selectors' => [
1996 '{{WRAPPER}} .better-payment .payment-form-layout .button:hover' => 'color: {{VALUE}} !important',
1997 '{{WRAPPER}} .better-payment .payment-form-layout.payment-form-layout-3 .button:hover' => 'color: {{VALUE}} !important',
1998 ],
1999 ]
2000 );
2001
2002 $this->add_control(
2003 'better_payment_form_button_hover_border',
2004 [
2005 'label' => __( 'Border Color', 'better-payment' ),
2006 'type' => Controls_Manager::COLOR,
2007 'default' => '',
2008 'selectors' => [
2009 '{{WRAPPER}} .better-payment .payment-form-layout .button:hover' => 'border-color: {{VALUE}}',
2010 ],
2011 ]
2012 );
2013
2014 $this->end_controls_tab();
2015
2016 $this->end_controls_tabs();
2017
2018 $this->end_controls_section();
2019 }
2020
2021 // public function success_message_style() {
2022
2023 // $this->start_controls_section(
2024 // 'better_payment_section_success_style',
2025 // [
2026 // 'label' => __( 'Success Message', 'better-payment' ),
2027 // 'tab' => Controls_Manager::TAB_STYLE,
2028 // ]
2029 // );
2030
2031 // $this->add_group_control(
2032 // Group_Control_Background::get_type(),
2033 // [
2034 // 'name' => 'better_payment_success_background',
2035 // 'label' => __( 'Background', 'better-payment' ),
2036 // 'types' => [ 'classic', 'gradient' ],
2037 // 'selector' => '{{WRAPPER}} .better-payment-success-report',
2038 // ]
2039 // );
2040
2041
2042 // $this->add_responsive_control(
2043 // 'better_payment_success_alignment',
2044 // [
2045 // 'label' => esc_html__( 'Form Max Width', 'better-payment' ),
2046 // 'type' => Controls_Manager::SLIDER,
2047 // 'size_units' => [ 'px', 'em', '%' ],
2048 // 'range' => [
2049 // 'px' => [
2050 // 'min' => 10,
2051 // 'max' => 1500,
2052 // ],
2053 // 'em' => [
2054 // 'min' => 1,
2055 // 'max' => 80,
2056 // ],
2057 // ],
2058 // 'selectors' => [
2059 // '{{WRAPPER}} .better-payment-success-report' => 'max-width: {{SIZE}}{{UNIT}};',
2060 // ],
2061 // ]
2062 // );
2063
2064 // $this->add_responsive_control(
2065 // 'better_payment_success_margin',
2066 // [
2067 // 'label' => esc_html__( 'Margin', 'better-payment' ),
2068 // 'type' => Controls_Manager::DIMENSIONS,
2069 // 'size_units' => [ 'px', 'em', '%' ],
2070 // 'selectors' => [
2071 // '{{WRAPPER}} .better-payment-success-report' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2072 // ],
2073 // ]
2074 // );
2075
2076 // $this->add_responsive_control(
2077 // 'better_payment_success_padding',
2078 // [
2079 // 'label' => esc_html__( 'Form Padding', 'better-payment' ),
2080 // 'type' => Controls_Manager::DIMENSIONS,
2081 // 'size_units' => [ 'px', 'em', '%' ],
2082 // 'selectors' => [
2083 // '{{WRAPPER}} .better-payment-success-report' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2084 // ],
2085 // ]
2086 // );
2087
2088 // $this->add_control(
2089 // 'better_payment_success_border_radius',
2090 // [
2091 // 'label' => esc_html__( 'Border Radius', 'better-payment' ),
2092 // 'type' => Controls_Manager::DIMENSIONS,
2093 // 'separator' => 'before',
2094 // 'size_units' => [ 'px' ],
2095 // 'selectors' => [
2096 // '{{WRAPPER}} .better-payment-success-report' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2097 // ],
2098 // ]
2099 // );
2100
2101 // $this->add_group_control(
2102 // Group_Control_Border::get_type(),
2103 // [
2104 // 'name' => 'better_payment_success_border',
2105 // 'selector' => '{{WRAPPER}} .better-payment-success-report',
2106 // ]
2107 // );
2108
2109 // $this->add_group_control(
2110 // Group_Control_Box_Shadow::get_type(),
2111 // [
2112 // 'name' => 'better_payment_success_box_shadow',
2113 // 'selector' => '{{WRAPPER}} .better-payment-success-report',
2114 // ]
2115 // );
2116
2117 // // Success Icon Style : Starts
2118 // $this->add_control(
2119 // 'better_payment_success_icon_style',
2120 // [
2121 // 'label' => __('Icon Style', 'better-payment'),
2122 // 'type' => Controls_Manager::HEADING,
2123 // 'separator' => 'before',
2124 // ]
2125 // );
2126
2127 // $this->add_responsive_control(
2128 // 'better_payment_success_icon_margin',
2129 // [
2130 // 'label' => __('Margin', 'better-payment'),
2131 // 'type' => Controls_Manager::DIMENSIONS,
2132 // 'size_units' => ['px', '%', 'em'],
2133 // 'selectors' => [
2134 // '{{WRAPPER}} .better-payment-success-report .report__thumb' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
2135 // ],
2136 // ]
2137 // );
2138
2139 // $this->add_responsive_control(
2140 // 'better_payment_success_icon_padding',
2141 // [
2142 // 'label' => __('Padding', 'better-payment'),
2143 // 'type' => Controls_Manager::DIMENSIONS,
2144 // 'size_units' => ['px', '%', 'em'],
2145 // 'selectors' => [
2146 // '{{WRAPPER}} .better-payment-success-report .report__thumb' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
2147 // ],
2148 // ]
2149 // );
2150
2151 // $this->add_responsive_control(
2152 // 'better_payment_success_icon_max_width',
2153 // [
2154 // 'label' => esc_html__( 'Max Width', 'better-payment' ),
2155 // 'type' => Controls_Manager::SLIDER,
2156 // 'size_units' => [ 'px', 'em', '%' ],
2157 // 'range' => [
2158 // 'px' => [
2159 // 'min' => 10,
2160 // 'max' => 1000,
2161 // ],
2162 // 'em' => [
2163 // 'min' => 1,
2164 // 'max' => 50,
2165 // ],
2166 // ],
2167 // 'selectors' => [
2168 // '{{WRAPPER}} .better-payment-success-report .report__thumb img' => 'max-width: {{SIZE}}{{UNIT}};',
2169 // ],
2170 // ]
2171 // );
2172
2173 // $this->add_responsive_control(
2174 // 'better_payment_success_icon_font_size',
2175 // [
2176 // 'label' => esc_html__( 'Icon Font Size', 'better-payment' ),
2177 // 'type' => Controls_Manager::SLIDER,
2178 // 'size_units' => [ 'px', 'em', '%' ],
2179 // 'range' => [
2180 // 'px' => [
2181 // 'min' => 10,
2182 // 'max' => 100,
2183 // ],
2184 // 'em' => [
2185 // 'min' => 1,
2186 // 'max' => 50,
2187 // ],
2188 // ],
2189 // 'selectors' => [
2190 // '{{WRAPPER}} .better-payment-success-report .report__thumb i' => 'font-size: {{SIZE}}{{UNIT}};',
2191 // ],
2192 // ]
2193 // );
2194 // // Success Icon Style : Ends
2195
2196 // $this->add_control(
2197 // 'better_payment_success_heading_style',
2198 // [
2199 // 'label' => esc_html__( 'Heading Style', 'better-payment' ),
2200 // 'type' => Controls_Manager::HEADING,
2201 // 'separator' => 'before',
2202 // ]
2203 // );
2204
2205 // $this->add_control(
2206 // 'better_payment_success_heading_color',
2207 // [
2208 // 'label' => __( 'Color', 'better-payment' ),
2209 // 'type' => Controls_Manager::COLOR,
2210 // 'selectors' => [
2211 // '{{WRAPPER}} .better-payment-success-report .transaction__success' => 'color: {{VALUE}}',
2212 // ],
2213 // ]
2214 // );
2215
2216 // $this->add_group_control(
2217 // Group_Control_Typography::get_type(),
2218 // [
2219 // 'name' => 'better_payment_success_heading_typography',
2220 // 'label' => __( 'Typography', 'better-payment' ),
2221 // 'scheme' => Typography::TYPOGRAPHY_4,
2222 // 'selector' => '{{WRAPPER}} .better-payment-success-report .transaction__success',
2223 // ]
2224 // );
2225
2226
2227 // $this->add_control(
2228 // 'better_payment_success_transaction_style',
2229 // [
2230 // 'label' => esc_html__( 'Transaction Style', 'better-payment' ),
2231 // 'type' => Controls_Manager::HEADING,
2232 // 'separator' => 'before',
2233 // ]
2234 // );
2235
2236 // $this->add_control(
2237 // 'better_payment_success_transaction_color',
2238 // [
2239 // 'label' => __( 'Color', 'better-payment' ),
2240 // 'type' => Controls_Manager::COLOR,
2241 // 'selectors' => [
2242 // '{{WRAPPER}} .better-payment-success-report .transaction__number' => 'color: {{VALUE}}',
2243 // ],
2244 // ]
2245 // );
2246
2247 // $this->add_group_control(
2248 // Group_Control_Typography::get_type(),
2249 // [
2250 // 'name' => 'better_payment_success_transaction_typography',
2251 // 'label' => __( 'Typography', 'better-payment' ),
2252 // 'scheme' => Typography::TYPOGRAPHY_4,
2253 // 'selector' => '{{WRAPPER}} .better-payment-success-report .transaction__number',
2254 // ]
2255 // );
2256
2257 // $this->add_control(
2258 // 'better_payment_success_thank_you_style',
2259 // [
2260 // 'label' => esc_html__( 'Thank You Message', 'better-payment' ),
2261 // 'type' => Controls_Manager::HEADING,
2262 // 'separator' => 'before',
2263 // ]
2264 // );
2265
2266 // $this->add_control(
2267 // 'better_payment_success_thank_you_color',
2268 // [
2269 // 'label' => __( 'Color', 'better-payment' ),
2270 // 'type' => Controls_Manager::COLOR,
2271 // 'selectors' => [
2272 // '{{WRAPPER}} .better-payment-success-report .payment__greeting' => 'color: {{VALUE}}',
2273 // ],
2274 // ]
2275 // );
2276
2277 // $this->add_group_control(
2278 // Group_Control_Typography::get_type(),
2279 // [
2280 // 'name' => 'better_payment_success_thank_you_typography',
2281 // 'label' => __( 'Typography', 'better-payment' ),
2282 // 'scheme' => Typography::TYPOGRAPHY_4,
2283 // 'selector' => '{{WRAPPER}} .better-payment-success-report .payment__greeting',
2284 // ]
2285 // );
2286
2287 // $this->end_controls_section();
2288 // }
2289
2290 // public function error_message_style() {
2291
2292 // $this->start_controls_section(
2293 // 'better_payment_section_error_style',
2294 // [
2295 // 'label' => __( 'Error Message', 'better-payment' ),
2296 // 'tab' => Controls_Manager::TAB_STYLE,
2297 // ]
2298 // );
2299
2300 // $this->add_group_control(
2301 // Group_Control_Background::get_type(),
2302 // [
2303 // 'name' => 'better_payment_error_background',
2304 // 'label' => __( 'Background', 'better-payment' ),
2305 // 'types' => [ 'classic', 'gradient' ],
2306 // 'selector' => '{{WRAPPER}} .better-payment-error-report',
2307 // ]
2308 // );
2309
2310
2311 // $this->add_responsive_control(
2312 // 'better_payment_error_alignment',
2313 // [
2314 // 'label' => esc_html__( 'Form Max Width', 'better-payment' ),
2315 // 'type' => Controls_Manager::SLIDER,
2316 // 'size_units' => [ 'px', 'em', '%' ],
2317 // 'range' => [
2318 // 'px' => [
2319 // 'min' => 10,
2320 // 'max' => 1500,
2321 // ],
2322 // 'em' => [
2323 // 'min' => 1,
2324 // 'max' => 80,
2325 // ],
2326 // ],
2327 // 'selectors' => [
2328 // '{{WRAPPER}} .better-payment-error-report' => 'max-width: {{SIZE}}{{UNIT}};',
2329 // ],
2330 // ]
2331 // );
2332
2333 // $this->add_responsive_control(
2334 // 'better_payment_error_margin',
2335 // [
2336 // 'label' => esc_html__( 'Margin', 'better-payment' ),
2337 // 'type' => Controls_Manager::DIMENSIONS,
2338 // 'size_units' => [ 'px', 'em', '%' ],
2339 // 'selectors' => [
2340 // '{{WRAPPER}} .better-payment-error-report' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2341 // ],
2342 // ]
2343 // );
2344
2345 // $this->add_responsive_control(
2346 // 'better_payment_error_padding',
2347 // [
2348 // 'label' => esc_html__( 'Form Padding', 'better-payment' ),
2349 // 'type' => Controls_Manager::DIMENSIONS,
2350 // 'size_units' => [ 'px', 'em', '%' ],
2351 // 'selectors' => [
2352 // '{{WRAPPER}} .better-payment-error-report' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2353 // ],
2354 // ]
2355 // );
2356
2357 // $this->add_control(
2358 // 'better_payment_error_border_radius',
2359 // [
2360 // 'label' => esc_html__( 'Border Radius', 'better-payment' ),
2361 // 'type' => Controls_Manager::DIMENSIONS,
2362 // 'separator' => 'before',
2363 // 'size_units' => [ 'px' ],
2364 // 'selectors' => [
2365 // '{{WRAPPER}} .better-payment-error-report' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2366 // ],
2367 // ]
2368 // );
2369
2370 // $this->add_group_control(
2371 // Group_Control_Border::get_type(),
2372 // [
2373 // 'name' => 'better_payment_error_border',
2374 // 'selector' => '{{WRAPPER}} .better-payment-error-report',
2375 // ]
2376 // );
2377
2378 // $this->add_group_control(
2379 // Group_Control_Box_Shadow::get_type(),
2380 // [
2381 // 'name' => 'better_payment_error_box_shadow',
2382 // 'selector' => '{{WRAPPER}} .better-payment-error-report',
2383 // ]
2384 // );
2385
2386 // // Error Icon Style : Starts
2387 // $this->add_control(
2388 // 'better_payment_error_icon_style',
2389 // [
2390 // 'label' => __('Icon Style', 'better-payment'),
2391 // 'type' => Controls_Manager::HEADING,
2392 // 'separator' => 'before',
2393 // ]
2394 // );
2395
2396 // $this->add_responsive_control(
2397 // 'better_payment_error_icon_margin',
2398 // [
2399 // 'label' => __('Margin', 'better-payment'),
2400 // 'type' => Controls_Manager::DIMENSIONS,
2401 // 'size_units' => ['px', '%', 'em'],
2402 // 'selectors' => [
2403 // '{{WRAPPER}} .better-payment-error-report .report__thumb' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
2404 // ],
2405 // ]
2406 // );
2407
2408 // $this->add_responsive_control(
2409 // 'better_payment_error_icon_padding',
2410 // [
2411 // 'label' => __('Padding', 'better-payment'),
2412 // 'type' => Controls_Manager::DIMENSIONS,
2413 // 'size_units' => ['px', '%', 'em'],
2414 // 'selectors' => [
2415 // '{{WRAPPER}} .better-payment-error-report .report__thumb' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
2416 // ],
2417 // ]
2418 // );
2419
2420 // $this->add_responsive_control(
2421 // 'better_payment_error_icon_max_width',
2422 // [
2423 // 'label' => esc_html__( 'Max Width', 'better-payment' ),
2424 // 'type' => Controls_Manager::SLIDER,
2425 // 'size_units' => [ 'px', 'em', '%' ],
2426 // 'range' => [
2427 // 'px' => [
2428 // 'min' => 10,
2429 // 'max' => 1000,
2430 // ],
2431 // 'em' => [
2432 // 'min' => 1,
2433 // 'max' => 50,
2434 // ],
2435 // ],
2436 // 'selectors' => [
2437 // '{{WRAPPER}} .better-payment-error-report .report__thumb img' => 'max-width: {{SIZE}}{{UNIT}};',
2438 // ],
2439 // ]
2440 // );
2441
2442 // $this->add_responsive_control(
2443 // 'better_payment_error_icon_font_size',
2444 // [
2445 // 'label' => esc_html__( 'Icon Font Size', 'better-payment' ),
2446 // 'type' => Controls_Manager::SLIDER,
2447 // 'size_units' => [ 'px', 'em', '%' ],
2448 // 'range' => [
2449 // 'px' => [
2450 // 'min' => 10,
2451 // 'max' => 100,
2452 // ],
2453 // 'em' => [
2454 // 'min' => 1,
2455 // 'max' => 50,
2456 // ],
2457 // ],
2458 // 'selectors' => [
2459 // '{{WRAPPER}} .better-payment-error-report .report__thumb i' => 'font-size: {{SIZE}}{{UNIT}};',
2460 // ],
2461 // ]
2462 // );
2463 // // Error Icon Style : Ends
2464
2465 // $this->add_control(
2466 // 'better_payment_error_heading_style',
2467 // [
2468 // 'label' => esc_html__( 'Heading Style', 'better-payment' ),
2469 // 'type' => Controls_Manager::HEADING,
2470 // 'separator' => 'before',
2471 // ]
2472 // );
2473
2474 // $this->add_control(
2475 // 'better_payment_error_heading_color',
2476 // [
2477 // 'label' => __( 'Color', 'better-payment' ),
2478 // 'type' => Controls_Manager::COLOR,
2479 // 'selectors' => [
2480 // '{{WRAPPER}} .better-payment-error-report .transaction__failed' => 'color: {{VALUE}}',
2481 // ],
2482 // ]
2483 // );
2484
2485 // $this->add_group_control(
2486 // Group_Control_Typography::get_type(),
2487 // [
2488 // 'name' => 'better_payment_error_heading_typography',
2489 // 'label' => __( 'Typography', 'better-payment' ),
2490 // 'scheme' => Typography::TYPOGRAPHY_4,
2491 // 'selector' => '{{WRAPPER}} .better-payment-error-report .transaction__failed',
2492 // ]
2493 // );
2494
2495 // $this->end_controls_section();
2496 // }
2497
2498 /**
2499 * Render the widget output on the frontend.
2500 *
2501 * @since 1.0.0
2502 */
2503 protected function render() {
2504
2505 $settings = $this->get_settings_for_display();
2506
2507 if( !class_exists('woocommerce') ) {
2508 if(!empty($settings[ 'better_payment_form_payment_source' ]) && 'woocommerce' === $settings['better_payment_form_payment_source'] ){
2509 printf( '<div class="better-payment"><div class="better-payment-notice notification is-danger is-light">%s</div></div>', __( '<a href="plugin-install.php?s=woocommerce&tab=search&type=term" target="_blank"><strong>WooCommerce</strong></a> is not installed/activated on your site. Please install and activate <a href="plugin-install.php?s=woocommerce&tab=search&type=term" target="_blank"><strong>WooCommerce</strong></a> first.', 'better-payment' ) );
2510 return false;
2511 }
2512 }
2513
2514 if ( $settings[ 'better_payment_form_paypal_enable' ] != 'yes' && $settings[ 'better_payment_form_stripe_enable' ] != 'yes' ) {
2515 return false;
2516 }
2517
2518 if( 'yes' === $settings[ 'better_payment_form_paypal_enable' ] && empty( $settings[ 'better_payment_paypal_business_email' ] ) ) {
2519 printf( '<div class="better-payment"><div class="better-payment-notice notification is-danger is-light">%s</div></div>', __( 'Whoops! It seems like you haven\'t configured <b>PayPal (Business Email) Settings</b>. Make sure to configure these settings before you publish the form.', 'better-payment' ) );
2520 return false;
2521 }
2522
2523 if(
2524 'yes' === $settings[ 'better_payment_form_stripe_enable' ] &&
2525 ( empty( $settings[ 'better_payment_stripe_public_key' ] ) || empty( $settings[ 'better_payment_stripe_secret_key' ] ) )
2526 ){
2527 printf( '<div class="better-payment"><div class="better-payment-notice notification is-danger is-light">%s</div></div>', __( 'Whoops! It seems like you haven\'t configured <b>Stripe (Public and Secret Key) Settings</b>. Make sure to configure these settings before you publish the form.', 'better-payment' ) );
2528 return false;
2529 }
2530
2531 $payment_field = "number" ;
2532
2533 $response = Better_Payment_Handler::manage_response( $settings );
2534 if ( $response ) {
2535 return false;
2536 }
2537
2538 wp_enqueue_script( 'better-payment' );
2539
2540 $action = esc_url( admin_url( 'admin-post.php' ) );
2541 $setting_meta = json_encode( [
2542 'page_id' => get_the_ID(),
2543 'widget_id' => esc_attr( $this->get_id() ),
2544 ] );
2545
2546 $better_payment_placeholder_class = '';
2547 if ( !empty($settings[ 'better_payment_placeholder_switch' ]) && $settings[ 'better_payment_placeholder_switch' ] != 'yes' ) {
2548 $better_payment_placeholder_class = 'better-payment-hide-placeholder';
2549 }
2550
2551 $data = array(
2552 'payment_field' => $payment_field,
2553 'action' => $action,
2554 'setting_meta' => $setting_meta,
2555 'better_payment_placeholder_class' => $better_payment_placeholder_class,
2556 );
2557
2558 $widgetObj = $this;
2559 $extraDatas = $data;
2560
2561 $better_payment_form_layout = sanitize_text_field($settings[ 'better_payment_form_layout' ]);
2562 $better_payment_form_layout = in_array($better_payment_form_layout, $this->better_payment_free_layouts()) ? $better_payment_form_layout : 'layout-1';
2563
2564 $template_file = BETTER_PAYMENT_ADMIN_VIEWS_PATH . '/elementor/layouts/' . $better_payment_form_layout . '.php';
2565 $better_payment_form_content = '';
2566
2567 if ( file_exists($template_file) ) {
2568 ob_start();
2569 include $template_file;
2570 $better_payment_form_content = ob_get_contents();
2571 ob_end_clean();
2572 }
2573
2574 $better_payment_form_content = apply_filters( 'better_payment/elementor/editor/get_layout_content', $better_payment_form_content, $settings, $this, $data );
2575
2576 echo $better_payment_form_content;
2577 }
2578
2579 /**
2580 * Render amount element
2581 *
2582 * @since 0.0.1
2583 */
2584 public function render_amount_element( $settings ) {
2585 $id = esc_attr( $this->get_id() );
2586 ?>
2587 <div class="pt-5">
2588 <?php
2589 foreach ( $settings[ 'better_payment_amount' ] as $item ) {
2590 $uid = uniqid();
2591 ?>
2592 <div class="bp-form__group">
2593 <input type="radio" value="<?php echo floatval( $item[ 'better_payment_amount_val' ] ); ?>"
2594 id="bp_payment_amount-<?php echo esc_attr($uid); ?>" class="bp-form__control bp-form_pay-radio "
2595 name="payment_amount[<?php echo esc_attr($id); ?>]">
2596 <label for="bp_payment_amount-<?php echo esc_attr($uid); ?>"><?php printf( "%s%s", Better_Payment_Handler::get_currency_symbols( esc_html($settings[ 'better_payment_form_currency' ]) ), floatval( $item[ 'better_payment_amount_val' ] ) ); ?></label>
2597 </div>
2598 <?php
2599 }
2600 ?>
2601 </div>
2602 <?php
2603 }
2604
2605 public function better_payment_free_layouts(){
2606 return [
2607 'layout-1',
2608 'layout-2',
2609 'layout-3',
2610 ];
2611 }
2612
2613 }
2614