I'm working in Expression Engine 3 and I'm working on a custom field type, specifically the options for said field type. I've been following the docs along with how to build out the form for the settings, and everything is rendering correctly.
My question is with regard to checkboxes (and radio buttons), how do I determine which boxes should be pre-selected based on the currently saved settings?
The code I have for outputting the checkboxes is as follows:
$settings = array(
array(
'title' => 'Select your option(s):',
'fields' => array(
'multi' => array(
'type' => 'checkbox',
'choices' => array(
'1' => 'Option 1',
'2' => 'Option 2'
)
)
)
),
Now, in the display_settings($data) function, if I do a var_dump($data) I can see the values being correctly pulled in. But the checkboxes will not automatically set themselves to selected if they should be.
Any advice would be lovely, thank you! Also, I'd be happy to provide more specific details if needed.