Slider field not working for steps lower than 1
Hi, I´ve found that the sanitizing callback for the slider field doesn´t allow the use of steps smaller than 1 for the sliders (for instance: 'step' => .01).
The problem is that, in Fields.php, the fallback_callback function forces the use of the number sanitizing:
case 'slider' : $sanitize_callback = 'kirki_sanitize_number';
And, as can be seen in sanitize.php, that callback returns integers only:
function kirki_sanitize_number( $value ) { return ( is_int( $value ) || is_float( $value ) ) ? $value : intval( $value ); }
I use slider control as opacity control, (min : 0 and max : 1) and I have the same problem.
I have checked the code and I tried to debug it. but uncommon behavior is that on processing a float value (e.g. 0.83) both is_int & is_float functions return false.
I have temporarily changed line 18 of sanitize.php to:
return (is_int($value) ? intval($value) : floatval($value));
and it works, but I'm not sure this is the correct approach.
Since that would affect other fields instead of just the slider, what I´ve done in my case (also as a temporary fix) is modify line 551 of Fields.php, removing the sanitization for slider fields:
case 'slider' :
// $sanitize_callback = 'kirki_sanitize_number';
$sanitize_callback = 'kirki_sanitize_unfiltered';