PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.2.0
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.2.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 1.0.5 1.0.6 All 66 releases
better-payment / includes / Admin / Elementor / Controls / Select2.php

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

71 lines 2.5 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\Controls;
4
5 if (!defined('ABSPATH')) {
6 exit();
7 } // Exit if accessed directly
8
9 use \Elementor\Base_Data_Control;
10
11 class Select2 extends Base_Data_Control
12 {
13 public function get_type()
14 {
15 return 'better-payment-select2';
16 }
17
18 public function enqueue()
19 {
20 wp_register_script('better-payment-select2', BETTER_PAYMENT_ASSETS . '/js/elementor/edit/better-payment-select2.min.js',
21 ['jquery-elementor-select2'], '1.0.0', true);
22 wp_localize_script(
23 'better-payment-select2',
24 'better_payment_select2_localize',
25 [
26 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
27 'search_text' => esc_html__( 'Search', 'better-payment' ),
28 'remove' => __( 'Remove', 'better-payment' ),
29 'thumbnail' => __( 'Image', 'better-payment' ),
30 'name' => __( 'Title', 'better-payment' ),
31 'price' => __( 'Price', 'better-payment' ),
32 'quantity' => __( 'Quantity', 'better-payment' ),
33 'subtotal' => __( 'Subtotal', 'better-payment' ),
34 ]
35 );
36 wp_enqueue_script('better-payment-select2');
37 }
38
39 protected function get_default_settings()
40 {
41 return [
42 'multiple' => false,
43 'source_name' => 'post_type',
44 'source_type' => 'post',
45 ];
46 }
47
48 public function content_template()
49 {
50 $control_uid = $this->get_control_uid();
51 ?>
52 <# var controlUID = '<?php echo esc_html( $control_uid ); ?>'; #>
53 <# var currentID = elementor.panel.currentView.currentPageView.model.attributes.settings.attributes[data.name]; #>
54 <div class="elementor-control-field">
55 <# if ( data.label ) { #>
56 <label for="<?php echo esc_attr( $control_uid ); ?>" class="elementor-control-title">{{{data.label }}}</label>
57 <# } #>
58 <div class="elementor-control-input-wrapper elementor-control-unit-5">
59 <# var multiple = ( data.multiple ) ? 'multiple' : ''; #>
60 <select id="<?php echo esc_attr( $control_uid ); ?>" {{ multiple }} class="ea-select2" data-setting="{{ data.name }}"></select>
61 </div>
62 </div>
63 <#
64 ( function( $ ) {
65 $( document.body ).trigger( 'better_payment_select2_init',{currentID:data.controlValue,data:data,controlUID:controlUID,multiple:data.multiple} );
66 }( jQuery ) );
67 #>
68 <?php
69 }
70 }
71