<?php
if ( ! defined( 'ABSPATH' ) ) exit;
/**
 * @var array  $field
 * @var mixed  $value
 * @var string $name_base
 */
$on = ! empty( $value );
?>
<label class="cn-switch <?php echo $on ? 'is-on' : ''; ?>">
    <input type="checkbox"
           id="cn-field-<?php echo esc_attr( $field['id'] ); ?>"
           name="<?php echo esc_attr( $name_base ); ?>"
           value="1"
           class="cn-switch-input"
           <?php checked( $on ); ?> />
    <span class="cn-switch-track"><span class="cn-switch-thumb"></span></span>
    <span class="cn-switch-text">
        <span class="cn-switch-on">On</span>
        <span class="cn-switch-off">Off</span>
    </span>
</label>
