Fixed blueprint value filtering in lists [#2923]

This commit is contained in:
Matias Griese
2020-05-22 23:08:02 +03:00
parent 0e4a88d538
commit a156247dc3
2 changed files with 6 additions and 2 deletions

View File

@@ -5,6 +5,7 @@
* Changed `Folder::hasChildren` to `Folder::countChildren`
1. [](#bugfix)
* Fixed new `Flex Page` not having correct form fields for the page type
* Fixed blueprint value filtering in lists [#2923](https://github.com/getgrav/grav/issues/2923)
# v1.7.0-rc.11
## 05/14/2020

View File

@@ -202,11 +202,14 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface
continue;
}
if ($rule && $rule['type'] !== '_parent') {
$isParent = isset($val['*']);
if (!$isParent && $rule && $rule['type'] !== '_parent') {
$field = Validation::filter($field, $rule);
} elseif (\is_array($field) && \is_array($val)) {
// Array has been defined in blueprints.
$field = $this->filterArray($field, $val, $parent . $key . '.', $missingValuesAsNull, $keepEmptyValues);
$k = $isParent ? '*' : $key;
$field = $this->filterArray($field, $val, $parent . $k . '.', $missingValuesAsNull, $keepEmptyValues);
if (null === $field) {
// Nested parent has no values.