mirror of
https://github.com/getgrav/grav.git
synced 2026-07-04 11:57:58 +02:00
Improve array of bools filtering
This commit is contained in:
@@ -126,3 +126,4 @@ form:
|
||||
ignore_empty: true
|
||||
validate:
|
||||
type: array
|
||||
value_type: bool
|
||||
|
||||
@@ -45,3 +45,4 @@ form:
|
||||
ignore_empty: true
|
||||
validate:
|
||||
type: array
|
||||
value_type: bool
|
||||
|
||||
@@ -720,7 +720,13 @@ class Validation
|
||||
if ($type && $val !== '' && $val !== null) {
|
||||
switch ($type) {
|
||||
case 'bool':
|
||||
$val = Utils::isPositive($val);
|
||||
if (Utils::isPositive($val)) {
|
||||
$val = true;
|
||||
} elseif (Utils::isNegative($val)) {
|
||||
$val = false;
|
||||
} else {
|
||||
$val = null;
|
||||
}
|
||||
break;
|
||||
case 'int':
|
||||
$val = (int)$val;
|
||||
|
||||
Reference in New Issue
Block a user