'Boolean' // from CustomSettings ); /** * @return FieldList */ public function getCMSFields() { $fields = parent::getCMSFields(); $fields->replaceField('Default', CheckboxField::create( "CheckedDefault", _t('EditableFormField.CHECKEDBYDEFAULT', 'Checked by Default?') )); return $fields; } public function getFormField() { $field = CheckboxField::create($this->Name, $this->Title, $this->CheckedDefault); if ($this->Required) { // Required validation can conflict so add the Required validation messages // as input attributes $errorMessage = $this->getErrorMessage()->HTML(); $field->setAttribute('data-rule-required', 'true'); $field->setAttribute('data-msg-required', $errorMessage); } return $field; } public function getValueFromData($data) { $value = (isset($data[$this->Name])) ? $data[$this->Name] : false; return ($value) ? _t('EditableFormField.YES', 'Yes') : _t('EditableFormField.NO', 'No'); } public function migrateSettings($data) { // Migrate 'Default' setting to 'CheckedDefault' if(isset($data['Default'])) { $this->CheckedDefault = (bool)$data['Default']; unset($data['Default']); } parent::migrateSettings($data); } }