PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 4.7.2
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v4.7.2
4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 4.3.1 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.6.8 4.6.9 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.8.9 trunk 0.1.2-beta 0.1.3-beta 0.1.4-beta 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.8.0 1.8.1 1.9.0
shopengine / core / elementor-controls / ajax-select2.php
shopengine / core / elementor-controls Last commit date
assets 1 year ago ajax-select2.php 1 year ago control-manager.php 1 year ago image-choose.php 4 years ago init.php 3 years ago
ajax-select2.php
91 lines
1 <?php
2 namespace ShopEngine\Core\Elementor_Controls;
3
4 defined( 'ABSPATH' ) || exit;
5
6 class Ajax_Select2 extends \Elementor\Base_Data_Control {
7
8 public function get_api_url(){
9 return get_rest_url() . 'shopengine-builder/v1';
10 }
11
12 /**
13 * Get select2 control type.
14 *
15 * Retrieve the control type, in this case `select2`.
16 *
17 * @since 1.0.0
18 * @access public
19 *
20 * @return string Control type.
21 */
22 public function get_type() {
23 return 'shopengine_ajaxselect2';
24 }
25
26 /**
27 * Enqueue ontrol scripts and styles.
28 *
29 * @since 1.0.0
30 * @access public
31 */
32 public function enqueue() {
33 // script
34 wp_register_script( 'shopengine-js-ajaxchoose-control', Init::get_url() . 'assets/js/ajaxchoose.js' );
35 wp_enqueue_script( 'shopengine-js-ajaxchoose-control' );
36 }
37
38 /**
39 * Get select2 control default settings.
40 *
41 * Retrieve the default settings of the select2 control. Used to return the
42 * default settings while initializing the select2 control.
43 *
44 * @since 1.8.0
45 * @access protected
46 *
47 * @return array Control default settings.
48 */
49 protected function get_default_settings() {
50 return [
51 'options' => [],
52 'multiple' => false,
53 'select2options' => [],
54 ];
55 }
56
57
58 /**
59 * Render select2 control output in the editor.
60 *
61 * Used to generate the control HTML in the editor using Underscore JS
62 * template. The variables for the class are available using `data` JS
63 * object.
64 *
65 * @since 1.0.0
66 * @access public
67 */
68 public function content_template() {
69 $control_uid = $this->get_control_uid();
70 ?>
71 <div class="elementor-control-field">
72 <label for="<?php echo esc_attr($control_uid); ?>" class="elementor-control-title">{{{ data.label }}}</label>
73 <div class="elementor-control-input-wrapper">
74 <# var multiple = ( data.multiple ) ? 'multiple' : ''; #>
75 <select
76 id="<?php echo esc_attr($control_uid); ?>"
77 class="elementor-megamenushopengine_ajaxselect2"
78 type="megamenushopengine_ajaxselect2" {{ multiple }}
79 data-setting="{{ data.name }}"
80 data-ajax-url="<?php echo esc_attr($this->get_api_url() . '/{{data.options}}/'); ?>"
81 >
82 </select>
83 </div>
84 </div>
85 <# if ( data.description ) { #>
86 <div class="elementor-control-field-description">{{{ data.description }}}</div>
87 <# } #>
88 <?php
89 }
90 }
91