diff --git a/CHANGELOG.md b/CHANGELOG.md index f890b47ed..7ebc8772e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/system/src/Grav/Common/Data/BlueprintSchema.php b/system/src/Grav/Common/Data/BlueprintSchema.php index 0c954fa33..898450d28 100644 --- a/system/src/Grav/Common/Data/BlueprintSchema.php +++ b/system/src/Grav/Common/Data/BlueprintSchema.php @@ -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; }