Remove disabled fields from the form schema

This commit is contained in:
Matias Griese
2019-04-18 19:14:55 +03:00
parent 6cdfaeb8fb
commit 97af8919fc
2 changed files with 9 additions and 5 deletions

View File

@@ -2,7 +2,9 @@
## mm/dd/2019
1. [](#improved)
* Improve `FormTrait` backwards compatibility with existing forms
* Improve `FormTrait` backwards compatibility with existing forms
1. [](#bugfix)
* Remove disabled fields from the form schema
# v1.6.6
## 04/17/2019

View File

@@ -142,7 +142,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface
if ($rule) {
// Item has been defined in blueprints.
if (!empty($rule['validate']['ignore'])) {
if (!empty($rule['disabled']) || !empty($rule['validate']['ignore'])) {
// Skip validation in the ignored field.
continue;
}
@@ -178,7 +178,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface
$val = $rules[$key] ?? $rules['*'] ?? null;
$rule = \is_string($val) ? $this->items[$val] : null;
if (empty($rule['validate']['ignore'])) {
if (empty($rule['disabled']) && empty($rule['validate']['ignore'])) {
continue;
}
}
@@ -191,7 +191,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface
if ($rule) {
// Item has been defined in blueprints.
if (!empty($rule['validate']['ignore'])) {
if (!empty($rule['disabled']) || !empty($rule['validate']['ignore'])) {
// Skip any data in the ignored field.
unset($results[$key]);
continue;
@@ -240,6 +240,8 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface
if (
// Not an input field
!$field
// Field has been disabled
|| !empty($field['disabled'])
// Field validation is set to be ignored
|| !empty($field['validate']['ignore'])
// Field is toggleable and the toggle is turned off
@@ -273,7 +275,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface
$field = $this->items[$field];
// Skip ignored field, it will not be required.
if (!empty($field['validate']['ignore'])) {
if (!empty($field['disabled']) || !empty($field['validate']['ignore'])) {
continue;
}