Upload folder via GUI - inc
This commit is contained in:
20
inc/fields/class-field-range.php
Normal file
20
inc/fields/class-field-range.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
if (!defined('ABSPATH')) exit;
|
||||
class WMF_Field_Range extends WMF_Field_Base {
|
||||
public $type='range'; public $label='Schieberegler'; public $icon='dashicons-leftright'; public $category='auswahl';
|
||||
public function defaults() { return array_merge(parent::defaults(),array('min'=>'0','max'=>'100','step'=>'1','show_value'=>'1')); }
|
||||
public function render($field,$value='') {
|
||||
$val=$value!==''?$value:($field['min']??0); ?>
|
||||
<div class="<?php echo esc_attr($this->wrapper_classes($field)); ?>"<?php echo $this->conditional_attrs($field); ?> data-field-id="<?php echo esc_attr($field['id']); ?>">
|
||||
<?php $this->render_label($field); ?>
|
||||
<div class="wmf-range-wrap">
|
||||
<input type="range" id="<?php echo esc_attr($field['id']); ?>" name="wmf_fields[<?php echo esc_attr($field['id']); ?>]" value="<?php echo esc_attr($val); ?>" min="<?php echo esc_attr($field['min']??0); ?>" max="<?php echo esc_attr($field['max']??100); ?>" step="<?php echo esc_attr($field['step']??1); ?>" class="wmf-range-input">
|
||||
<?php if(!empty($field['show_value'])&&$field['show_value']==='1'): ?>
|
||||
<span class="wmf-range-value"><?php echo esc_html($val); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php $this->render_description($field); ?>
|
||||
</div><?php
|
||||
}
|
||||
public function sanitize($v,$f) { return is_numeric($v)?$v+0:$f['min']??0; }
|
||||
}
|
||||
Reference in New Issue
Block a user