# darkify/1.5.1/src/Admin/elementor/controls/class-elementor-control-switch.php

Darkify – Dark Mode &amp; Night Mode for Website &amp; Admin (Dark Theme Included), version 1.5.1. 79 lines.

- Page: https://pluginprobe.com/plugins/darkify/1.5.1/code/src/Admin/elementor/controls/class-elementor-control-switch.php
- Raw: https://pluginprobe.com/plugins/darkify/1.5.1/raw/src/Admin/elementor/controls/class-elementor-control-switch.php
- Modified: 2026-05-04T09:54:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/darkify/1.5.1/code/src/Admin/elementor/controls/class-elementor-control-switch.php#L10-L20`.

```php
<?php
defined('ABSPATH') || exit();

class Elementor_Darkify_Switcher extends \Elementor\Base_Data_Control
{

	public function get_type()
	{
		return 'darkify_switch';
	}

	/**
	 * Enqueue control scripts and styles.
	 *
	 * @since  1.0.0
	 * @access public
	 */
	public function enqueue()
	{
		wp_enqueue_style('darkify-admin-common', DARKIFY_DIR_URL . 'src/Admin/elementor/assets/elementor-switcher.css', [], DARKIFY_VERSION);
		wp_register_script(
			'darkify-js-elementor-switcher-additional',
			DARKIFY_DIR_URL . 'src/Admin/elementor/assets/elementor-switcher.js',
			[],
			DARKIFY_VERSION,
			true
		);

		wp_enqueue_script('darkify-js-elementor-switcher-additional');
	}

	/**
	 * Render choose control output in the editor.
	 *
	 * Used to generate the control HTML in the editor using Underscore JS
	 * template. The variables for the class are available using `data` JS
	 * object.
	 *
	 * @return mixed
	 * @since  1.0.0
	 * @access public
	 */
	public function content_template()
	{
?>
		<div class="elementor-control-field">
			<label class="elementor-control-title">{{{ data.label }}}</label>
			<div class="darkify-elementor">
				<div class="darkify-elementor-switches">
					<# _.each( data.options, function( switchId ) { #>
						<div class="darkify-elementor-switches-item elementor-control-input-wrapper 
						<# if ( switchId > 3 && switchId != 23 && !data.is_ultimate ) { #> darkify-locked <# } #>">
							<input id="{{ data.name }}-{{ switchId }}" type="radio" name="{{ data.name }}" data-setting="{{ data.name }}" value="{{ switchId }}"
								<# if ( switchId> 3 && switchId != 23 && !data.is_ultimate ) { #> disabled <# } #>
								<# if ( switchId==data.controlValue ) { #> checked="checked" <# } #> />
										<label for="{{ data.name }}-{{ switchId }}">
											<img src="{{ data.assets_url }}/{{ switchId }}.svg">
										</label>
						</div>
						<# }); #>
				</div>
			</div>
		</div>

		<# if ( data.description ) { #>
			<div class="elementor-control-field-description">{{{ data.description }}}</div>
			<# } #>
		<?php
	}

	protected function get_default_settings()
	{
		return [
			'options' => [],
			'toggle'  => true,
		];
	}
}

```
