| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template show toggle switch field |
| 4 |
*/ |
| 5 |
|
| 6 |
defined( 'ABSPATH' ) || exit(); |
| 7 |
|
| 8 |
if ( ! isset( $data ) ) { |
| 9 |
return; |
| 10 |
} |
| 11 |
?> |
| 12 |
<div class="lp-toggle-switch"> |
| 13 |
<input class="lp-toggle-switch-input" |
| 14 |
name="<?php echo esc_attr( $data['name'] ?? '' ); ?>" |
| 15 |
id="<?php echo esc_attr( $data['id'] ?? '' ); ?>" |
| 16 |
<?php echo esc_attr( $data['value'] ? 'checked' : '' ); ?> |
| 17 |
type="checkbox" value="<?php echo esc_attr( $data['value'] ?? 0 ); ?>" |
| 18 |
<?php echo sanitize_text_field( $data['extra'] ?? '' ); ?>> |
| 19 |
<label class="lp-toggle-switch-label" for="<?php echo esc_attr( $data['id'] ?? '' ); ?>"> |
| 20 |
<span class="toggle-on"></span> |
| 21 |
<span class="toggle-off"></span> |
| 22 |
</label> |
| 23 |
<span class="dashicons dashicons-update" style="display: none"></span> |
| 24 |
</div> |
| 25 |
|