| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 3 |
|
| 4 |
if (isset($option)) { |
| 5 |
$option_type = isset( $option['type'] ) ? $option['type'] : ''; |
| 6 |
$option_id = isset( $option['id'] ) ? $this->settings_name . '[' . $option['id'] . ']' : ''; |
| 7 |
$option_css = sanitize_html_class( $this->settings_name . '_' . $option['id'] ); |
| 8 |
|
| 9 |
$min = isset( $option['min'] ) ? 'min="' . $option['min'] . '"' : null; |
| 10 |
$max = isset( $option['max'] ) ? 'max="' . $option['max'] . '"' : null; |
| 11 |
$step = isset( $option['step'] ) ? 'step="' . $option['step'] . '"' : null; |
| 12 |
|
| 13 |
$attributes = array(); |
| 14 |
if ( isset( $option['attributes'] ) && is_array( $option['attributes'] ) ) { |
| 15 |
foreach ( $option['attributes'] as $attribute_name => $attribute_value ) { |
| 16 |
$attributes[] = esc_attr( $attribute_name ) . '="' . esc_attr( $attribute_value ) . '"'; |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
$value = wpsight_get_option( $option['id'] ); |
| 21 |
if( !isset( $value ) && isset( $option['default'] ) ) $value = $option['default']; |
| 22 |
|
| 23 |
$placeholder = isset( $option['placeholder'] ) ? 'placeholder="' . $option['placeholder'] . '"' : ''; |
| 24 |
?> |
| 25 |
|
| 26 |
<div class="wpsight-settings-field wpsight-settings-field-<?php echo esc_attr( $option_type ); ?>"> |
| 27 |
<input id="setting-<?php echo esc_attr( $option_css ); ?>" class="range-slider__range" type="<?php echo esc_attr( $option_type ); ?>" name="<?php echo esc_attr( $option_id ); ?>" value="<?php echo esc_attr( $value ); ?>" <?php echo esc_html( implode( ' ', $attributes ) ); ?> <?php echo esc_attr( $placeholder ); ?> <?php echo esc_attr( $min ); ?> <?php echo esc_attr( $max ); ?> <?php echo esc_attr( $step ); ?> /> |
| 28 |
<span class="range-slider__value">0</span> |
| 29 |
</div> |
| 30 |
|
| 31 |
<?php } ?> |
| 32 |
|
| 33 |
|