PluginProbe
WP Directory Kit / 1.5.4
WP Directory Kit v1.5.4
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
wpdirectorykit / elementor-elements / classes / includes / controls / wdk-field-selector.php

wdk-field-selector.php in WP Directory Kit 1.5.4, at elementor-elements/classes/includes/controls/wdk-field-selector.php

70 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Wdk\Includes\Controls;
4
5 use Elementor\Control_Select2;
6
7 if (! defined('ABSPATH')) {
8 exit();
9 }
10
11 class Wdk_Field_Selector extends Control_Select2
12 {
13
14 const INIT = 'wdk-fields-selector';
15
16 public function get_type()
17 {
18 return self::INIT;
19 }
20
21
22 public function content_template() {
23 ?>
24
25 <#
26 if(data.controlValue && data.controlValue.indexOf('__') !==-1){
27 data.controlValue=data.controlValue.split('__')[1];
28 }
29 #>
30
31 <div class="elementor-control-field">
32 <# if ( data.label ) {#>
33 <label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
34 <# } #>
35 <div class="elementor-control-input-wrapper elementor-control-unit-5">
36 <# var multiple = ( data.multiple ) ? 'multiple' : ''; #>
37 <select id="<?php $this->print_control_uid(); ?>" class="elementor-select2 el-wdk-selector-field" type="select2" {{ multiple }} data-setting="{{ data.name }}">
38 <# if ( data.raw_options ) { #>
39 <# _.each( data.raw_options, function( item ){ #>
40 <option value="{{ _.escape(item.value) }}"
41 <# if ( data.controlValue==item.value ) { #>
42 selected="selected"
43 <# } #>
44 >{{{ _.escape(item.label) }}}
45 </option>
46 <# } ); #>
47 <# } else { #>
48 <# _.each( data.options, function( label, value ) {
49
50 if ( typeof data.controlValue == 'string' ) {
51 var selected = ( value === data.controlValue ) ? 'selected' : '';
52 } else if ( null !== data.controlValue ) {
53 var selected = ( -1 !== data.controlValue.indexOf( value ) ) ? 'selected' : '';
54 }
55
56 #>
57 <option {{ selected }} value="{{ _.escape(value) }}">{{{ _.escape(label)}}}</option>
58 <# } ); #>
59 <# } #>
60 </select>
61 </div>
62 </div>
63 <# if ( data.description ) { #>
64 <div class="elementor-control-field-description">{{{ data.description }}}</div>
65 <# } #>
66 <?php
67 }
68
69 }
70