Silverstripe Version:
4.2.1
Question:
I’d like to be able to add a custom field to a model admin in order to save a custom message which will then be displayed/sent to all members. So far, I’ve achieved the display of the field by extending SilverStripe\Admin\SecurityAdmin using:
function getEditForm($id = null, $fields = null){
$form = parent::getEditForm($id, $fields);
$membersgrid = $form->Fields()->dataFieldByName("Members");
$form->Fields()->insertBefore("Members",TextareaField::create('CustomMsg'));
return $form;
}
How do I save any data to that field? Simply adding
private static $db = [
'CustomMsg' => 'Text'
];
doesn’t create a field, nor can I save changes. It should function in a similar way to extending SiteConfig. Any ideas?