PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 1.5.5
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v1.5.5
2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 trunk 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 All 57 releases
darkify / src / Admin / elementor / controls / class-elementor-control-switch.php

class-elementor-control-switch.php in Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) 1.5.5, at src/Admin/elementor/controls/class-elementor-control-switch.php

79 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined('ABSPATH') || exit();
3
4 class Elementor_Darkify_Switcher extends \Elementor\Base_Data_Control
5 {
6
7 public function get_type()
8 {
9 return 'darkify_switch';
10 }
11
12 /**
13 * Enqueue control scripts and styles.
14 *
15 * @since 1.0.0
16 * @access public
17 */
18 public function enqueue()
19 {
20 wp_enqueue_style('darkify-admin-common', DARKIFY_DIR_URL . 'src/Admin/elementor/assets/elementor-switcher.css', [], DARKIFY_VERSION);
21 wp_register_script(
22 'darkify-js-elementor-switcher-additional',
23 DARKIFY_DIR_URL . 'src/Admin/elementor/assets/elementor-switcher.js',
24 [],
25 DARKIFY_VERSION,
26 true
27 );
28
29 wp_enqueue_script('darkify-js-elementor-switcher-additional');
30 }
31
32 /**
33 * Render choose control output in the editor.
34 *
35 * Used to generate the control HTML in the editor using Underscore JS
36 * template. The variables for the class are available using `data` JS
37 * object.
38 *
39 * @return mixed
40 * @since 1.0.0
41 * @access public
42 */
43 public function content_template()
44 {
45 ?>
46 <div class="elementor-control-field">
47 <label class="elementor-control-title">{{{ data.label }}}</label>
48 <div class="darkify-elementor">
49 <div class="darkify-elementor-switches">
50 <# _.each( data.options, function( switchId ) { #>
51 <div class="darkify-elementor-switches-item elementor-control-input-wrapper
52 <# if ( switchId > 3 && switchId != 23 && !data.is_ultimate ) { #> darkify-locked <# } #>">
53 <input id="{{ data.name }}-{{ switchId }}" type="radio" name="{{ data.name }}" data-setting="{{ data.name }}" value="{{ switchId }}"
54 <# if ( switchId> 3 && switchId != 23 && !data.is_ultimate ) { #> disabled <# } #>
55 <# if ( switchId==data.controlValue ) { #> checked="checked" <# } #> />
56 <label for="{{ data.name }}-{{ switchId }}">
57 <img src="{{ data.assets_url }}/{{ switchId }}.svg">
58 </label>
59 </div>
60 <# }); #>
61 </div>
62 </div>
63 </div>
64
65 <# if ( data.description ) { #>
66 <div class="elementor-control-field-description">{{{ data.description }}}</div>
67 <# } #>
68 <?php
69 }
70
71 protected function get_default_settings()
72 {
73 return [
74 'options' => [],
75 'toggle' => true,
76 ];
77 }
78 }
79