I've got a form that's part of an 'Edit Profile' type page where the user makes a check box style selection from a list of Capabilities. I'm having problems figuring out what to pass as the last value in the constructor to set the defaults though. Obviously since it's an edit profile page I need the users current selections to show up when they load the page.
Code so far:
$capabilities = DataObject::get('Capability');
$capabilityField = new CheckboxSetField(
'Name',
'Capabilities: ',
$capabilities,
Array(
$testcap->Name
)
);
I have tried lots of different formats for the last parameter, including an array of Capability names, an array that looks like 'engines' => '1', an array of integers. What is the correct format to pass for the default array so that I can control which of the checkboxes are ticked?
Any advice appreciated.
Thanks