Merge pull request #73 from webbuilders-group/master

Proposed fix for issue #25
This commit is contained in:
Michael Parkhill 2014-08-06 16:03:50 +12:00
commit 8ee406675e

View File

@ -251,6 +251,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.