<?php
/**
 * Toggle Control Class for Customizer.
 *
 * Provides a toggle switch (on/off) UI control
 * for the WordPress Customizer.
 *
 * @package    Wira
 * @since      1.0.0
 */

namespace Wira;

/**
 * Customizer Toggle Control.
 *
 * Extends the WordPress Customizer control to render
 * a toggle switch for boolean settings.
 *
 * @since 1.0.0
 */
class Toggle_Control extends \WP_Customize_Control {

	/**
	 * Control type.
	 *
	 * @since 1.0.0
	 * @var string
	 */
	public $type = 'toggle';

	/**
	 * Render the toggle switch control.
	 *
	 * Outputs the HTML markup for the toggle button
	 * including label, input, and slider.
	 *
	 * @since 1.0.0
	 * @return void
	 */
	public function render_content() {
		?>
		<label class="customize-control-toggle">
			<span class="customize-control-title">
				<?php echo esc_html( $this->label ); ?>
			</span>
			<div class="switch">
				<input
					type="checkbox"
					<?php $this->link(); ?>
					value="1"
					<?php checked( $this->value(), 1 ); ?>
				/>
				<span class="slider"></span>
			</div>
		</label>
		<?php
	}
}
