57 lines
1.3 KiB
PHP
57 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Customize Toggle control class.
|
|
*
|
|
* @package consultstreet
|
|
*
|
|
* @see WP_Customize_Control
|
|
* @access public
|
|
*/
|
|
|
|
/**
|
|
* Class ConsultStreet_Customize_Toggle_Control
|
|
*/
|
|
class ConsultStreet_Customize_Toggle_Control extends ConsultStreet_Customize_Base_Control {
|
|
|
|
/**
|
|
* Customize control type.
|
|
*
|
|
* @access public
|
|
* @var string
|
|
*/
|
|
public $type = 'consultstreet-toggle';
|
|
|
|
/**
|
|
* Renders the Underscore template for this control.
|
|
*
|
|
* @see WP_Customize_Control::print_template()
|
|
* @access protected
|
|
* @return void
|
|
*/
|
|
protected function content_template() {
|
|
?>
|
|
|
|
<label for="toggle_{{ data.id }}">
|
|
<span class="customize-control-title">
|
|
{{{ data.label }}}
|
|
</span>
|
|
<# if ( data.description ) { #>
|
|
<span class="description customize-control-description">{{{ data.description }}}</span>
|
|
<# } #>
|
|
<input class="screen-reader-text" {{{ data.inputAttrs }}} name="toggle_{{ data.id }}"
|
|
id="toggle_{{ data.id }}" type="checkbox" value="{{ data.value }}" {{{ data.link }}}<# if ( true === data.value ) { #> checked<# } #> hidden />
|
|
<span class="switch"></span>
|
|
</label>
|
|
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* Render content is still called, so be sure to override it with an empty function in your subclass as well.
|
|
*/
|
|
protected function render_content() {
|
|
|
|
}
|
|
|
|
}
|