PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.6
ShopBuilder – WooCommerce Builder For Elementor v3.2.6
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | app/Elementor/Controls/Select2AjaxControl.php +57 -40 2.1.63.2.6 View file →
@@ -16,8 +16,11 @@
16 16 if ( ! defined( 'ABSPATH' ) ) {
17 17 exit( 'This script cannot be accessed directly.' );
18 18 }
19 19
20 +/**
21 + * Select2AjaxControl Register
22 + */
20 23 class Select2AjaxControl extends Base_Data_Control {
21 24
22 25 /**
23 26 * Set control name.
@@ -25,45 +28,56 @@
25 28 * @var string
26 29 */
27 30 public static $controlName = 'rt-select2';
28 31
32 + /**
33 + * @return string
34 + */
29 35 public function get_type() {
30 36 return self::$controlName;
31 37 }
32 38
39 + /**
40 + * @return void
41 + */
33 42 public function enqueue() {
34 43 wp_enqueue_script( 'rtsb-editor-script' );
35 44 wp_localize_script(
36 45 'rtsb-editor-script',
37 - 'rtSelect2Obj',
46 + 'rtsbSelect2Obj',
38 47 [
39 - 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
40 - 'search_text' => esc_html__( 'Please Select', 'textdomain' ),
48 + 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
49 + 'search_text' => esc_html__( 'Please Select', 'shopbuilder' ),
50 + 'nonceId' => rtsb()->nonceId,
51 + rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
41 52 ]
42 53 );
43 54 ?>
44 - <style>
45 - .rt-select2-main-wrapper ul.select2-selection__rendered li:last-child {
46 - pointer-events: none;
47 - }
55 + <style>
56 + .rt-select2-main-wrapper ul.select2-selection__rendered li:last-child {
57 + pointer-events: none;
58 + }
48 59
49 - .rt-select2-main-wrapper ul.select2-selection__rendered li:last-child::before {
50 - background: var(--e-a-btn-bg);
51 - content: '+';
52 - padding: 1px 5px;
53 - position: relative;
54 - top: 1px;
55 - margin-right: 5px;
56 - color: #fff;
57 - }
60 + .rt-select2-main-wrapper ul.select2-selection__rendered li:last-child::before {
61 + background: var(--e-a-btn-bg);
62 + content: '+';
63 + padding: 1px 5px;
64 + position: relative;
65 + top: 1px;
66 + margin-right: 5px;
67 + color: #fff;
68 + }
58 69
59 - .rt-select2-main-wrapper ul.select2-selection__rendered li[title=search] {
60 - display: none;
61 - }
62 - </style>
70 + .rt-select2-main-wrapper ul.select2-selection__rendered li[title=search] {
71 + display: none;
72 + }
73 + </style>
63 74 <?php
64 75 }
65 76
77 + /**
78 + * @return array
79 + */
66 80 protected function get_default_settings() {
67 81 return [
68 82 'multiple' => false,
69 83 'label_block' => true,
@@ -73,31 +87,34 @@
73 87 'maximum_selection_length' => - 1,
74 88 ];
75 89 }
76 90
91 + /**
92 + * @return void
93 + */
77 94 public function content_template() {
78 95 $control_uid = $this->get_control_uid();
79 96 ?>
80 97
81 - <# var controlUID = '<?php echo esc_html( $control_uid ); ?>'; #>
82 - <# var currentID = elementor.panel.currentView.currentPageView.model.attributes.settings.attributes[data.name]; #>
83 - <# var maxSelection = (data.maximum_selection_length > 0) ? 'max-select'+data.maximum_selection_length : 'unlimited-select' #>
84 - <div class="elementor-control-field rt-select2-main-wrapper {{maxSelection}}">
85 - <# if ( data.label ) { #>
86 - <label for="<?php echo esc_attr( $control_uid ); ?>" class="elementor-control-title">{{{data.label }}}</label>
87 - <# } #>
88 - <div class="elementor-control-input-wrapper elementor-control-unit-5">
89 - <# var multiple = ( data.multiple ) ? 'multiple' : ''; #>
90 - <select id="<?php echo esc_attr( $control_uid ); ?>" {{ multiple }} class="rt-select2" data-setting="{{ data.name }}"></select>
91 - </div>
92 - <# if ( data.description ) { #>
93 - <div class="elementor-control-field-description rtsb-description">{{{ data.description }}}</div>
94 - <# } #>
95 - </div>
96 - <#
97 - ( function( $ ) {
98 - $( document.body ).trigger( 'rt_select2_event',{currentID:data.controlValue,data:data,controlUID:controlUID,multiple:data.multiple} );
99 - }( jQuery ) );
100 - #>
98 + <# var controlUID = '<?php echo esc_html( $control_uid ); ?>'; #>
99 + <# var currentID = elementor.panel.currentView.currentPageView.model.attributes.settings.attributes[data.name]; #>
100 + <# var maxSelection = (data.maximum_selection_length > 0) ? 'max-select'+data.maximum_selection_length : 'unlimited-select' #>
101 + <div class="elementor-control-field rt-select2-main-wrapper {{maxSelection}}">
102 + <# if ( data.label ) { #>
103 + <label for="<?php echo esc_attr( $control_uid ); ?>" class="elementor-control-title">{{{data.label }}}</label>
104 + <# } #>
105 + <div class="elementor-control-input-wrapper elementor-control-unit-5">
106 + <# var multiple = ( data.multiple ) ? 'multiple' : ''; #>
107 + <select id="<?php echo esc_attr( $control_uid ); ?>" {{ multiple }} class="rt-select2" data-setting="{{ data.name }}"></select>
108 + </div>
109 + <# if ( data.description ) { #>
110 + <div class="elementor-control-field-description rtsb-description">{{{ data.description }}}</div>
111 + <# } #>
112 + </div>
113 + <#
114 + ( function( $ ) {
115 + $( document.body ).trigger( 'rt_select2_event',{currentID:data.controlValue,data:data,controlUID:controlUID,multiple:data.multiple} );
116 + }( jQuery ) );
117 + #>
101 118 <?php
102 119 }
103 120 }