| 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 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* Render choose control output in the editor. |
| 25 |
* |
| 26 |
* Used to generate the control HTML in the editor using Underscore JS |
| 27 |
* template. The variables for the class are available using `data` JS |
| 28 |
* object. |
| 29 |
* |
| 30 |
* @return mixed |
| 31 |
* @since 1.0.0 |
| 32 |
* @access public |
| 33 |
*/ |
| 34 |
public function content_template() |
| 35 |
{ |
| 36 |
?> |
| 37 |
<div class="elementor-control-field"> |
| 38 |
<label class="elementor-control-title">{{{ data.label }}}</label> |
| 39 |
<div class="darkify-elementor"> |
| 40 |
<div class="darkify-elementor-switches"> |
| 41 |
<# _.each( data.options, function( switchId ) { #> |
| 42 |
<div class="darkify-elementor-switches-item elementor-control-input-wrapper |
| 43 |
<# if ( switchId > 3 && switchId != 23 && !data.is_ultimate ) { #> darkify-locked <# } #>"> |
| 44 |
<input id="{{ data.name }}-{{ switchId }}" type="radio" name="{{ data.name }}" data-setting="{{ data.name }}" value="{{ switchId }}" |
| 45 |
<# if ( switchId> 3 && switchId != 23 && !data.is_ultimate ) { #> disabled <# } #> |
| 46 |
<# if ( switchId==data.controlValue ) { #> checked="checked" <# } #> /> |
| 47 |
<label for="{{ data.name }}-{{ switchId }}"> |
| 48 |
<img src="{{ data.assets_url }}/{{ switchId }}.svg"> |
| 49 |
</label> |
| 50 |
</div> |
| 51 |
<# }); #> |
| 52 |
</div> |
| 53 |
</div> |
| 54 |
</div> |
| 55 |
|
| 56 |
<# if ( data.description ) { #> |
| 57 |
<div class="elementor-control-field-description">{{{ data.description }}}</div> |
| 58 |
<# } #> |
| 59 |
<?php |
| 60 |
} |
| 61 |
|
| 62 |
protected function get_default_settings() |
| 63 |
{ |
| 64 |
return [ |
| 65 |
'options' => [], |
| 66 |
'toggle' => true, |
| 67 |
]; |
| 68 |
} |
| 69 |
} |
| 70 |
|