PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 4.0.1
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v4.0.1
4.0.2 4.0.1 4.0.0 3.10.02 3.10.01 3.9.10 3.9.9 3.9.8 3.9.7 3.9.5 3.9.6 3.9.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.3.1 2.3.1.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.4.0 2.5.0 2.5.1 2.5.10 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.2 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.6.0 3.6.1 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.9.0 3.9.1 3.9.2 trunk 1.2.6 1.2.7 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.0.9.1 2.0.9.2 2.0.9.3
elementskit-lite / modules / controls / ajax-select2.php
elementskit-lite / modules / controls Last commit date
assets 3 weeks ago ajax-select2-api.php 3 weeks ago ajax-select2.php 2 years ago control-manager.php 4 years ago image-choose.php 2 years ago init.php 4 years ago widget-area-modal.php 3 years ago widget-area-utils.php 6 months ago widget-area.php 2 years ago
ajax-select2.php
96 lines
1 <?php
2 namespace ElementsKit_Lite\Modules\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() . 'elementskit/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 '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 // Define script dependencies if needed.
34 $dependencies = array('jquery'); // Replace 'jquery' with the appropriate dependency.
35
36 // Register the script with version and set it to load in the footer.
37 wp_register_script('elementskit-js-ajaxchoose-control', Init::get_url() . 'assets/js/ajaxchoose.js', $dependencies, '1.0.0', true);
38
39 // Enqueue the script.
40 wp_enqueue_script('elementskit-js-ajaxchoose-control');
41 }
42
43 /**
44 * Get select2 control default settings.
45 *
46 * Retrieve the default settings of the select2 control. Used to return the
47 * default settings while initializing the select2 control.
48 *
49 * @since 1.8.0
50 * @access protected
51 *
52 * @return array Control default settings.
53 */
54 protected function get_default_settings() {
55 return array(
56 'options' => array(),
57 'multiple' => false,
58 'select2options' => array(),
59 );
60 }
61
62
63 /**
64 * Render select2 control output in the editor.
65 *
66 * Used to generate the control HTML in the editor using Underscore JS
67 * template. The variables for the class are available using `data` JS
68 * object.
69 *
70 * @since 1.0.0
71 * @access public
72 */
73 public function content_template() {
74 $control_uid = $this->get_control_uid();
75 ?>
76 <div class="elementor-control-field">
77 <label for="<?php echo esc_attr( $control_uid ); ?>" class="elementor-control-title">{{{ data.label }}}</label>
78 <div class="elementor-control-input-wrapper">
79 <# var multiple = ( data.multiple ) ? 'multiple' : ''; #>
80 <select
81 id="<?php echo esc_attr( $control_uid ); ?>"
82 class="elementor-megamenuajaxselect2"
83 type="megamenuajaxselect2" {{ multiple }}
84 data-setting="{{ data.name }}"
85 data-ajax-url="<?php echo esc_attr( $this->get_api_url() . '/{{data.options}}/' ); ?>"
86 >
87 </select>
88 </div>
89 </div>
90 <# if ( data.description ) { #>
91 <div class="elementor-control-field-description">{{{ data.description }}}</div>
92 <# } #>
93 <?php
94 }
95 }
96