mirror of
https://github.com/getgrav/grav.git
synced 2026-05-07 00:06:37 +02:00
Generalize FolderStorage templating
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
* Fixed `Flex Object` missing key field value when using `FolderStorage`
|
||||
* Fixed broken Twig try tag when catch has not been defined or is empty
|
||||
* Fixed `FlexForm` serialization
|
||||
* Fixed form validation for numeric values in PHP 8
|
||||
|
||||
# v1.7.18
|
||||
## 07/19/2021
|
||||
|
||||
@@ -519,17 +519,30 @@ class Validation
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($params['min']) && $value < $params['min']) {
|
||||
return false;
|
||||
$value = (float)$value;
|
||||
|
||||
$min = 0;
|
||||
if (isset($params['min'])) {
|
||||
$min = (float)$params['min'];
|
||||
if ($value < $min) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($params['max']) && $value > $params['max']) {
|
||||
return false;
|
||||
if (isset($params['max'])) {
|
||||
$max = (float)$params['max'];
|
||||
if ($value > $max) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$min = $params['min'] ?? 0;
|
||||
if (isset($params['step'])) {
|
||||
$step = (float)$params['step'];
|
||||
|
||||
return !(isset($params['step']) && fmod($value - $min, $params['step']) === 0);
|
||||
return fmod($value - $min, $step) === 0.0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user