diff --git a/code/model/Widget.php b/code/model/Widget.php index 725a43b..23eea37 100644 --- a/code/model/Widget.php +++ b/code/model/Widget.php @@ -240,6 +240,14 @@ class Widget extends DataObject { } } + //Look for checkbox fields not present in the data + foreach($fields as $field) { + if($field instanceof CheckboxField && !array_key_exists($field->getName(), $data)) { + $field->setValue(false); + $field->saveInto($this); + } + } + $this->write(); // The field must be written to ensure a unique ID.