How do I define checkboxes in a form in Drupal 9
in Drupal 8 & 9 form api you can define checkboxes like below:
$form['high_school']['tests_taken'] = [
'#type' => 'checkboxes',
'#options' => array('SAT' => $this->t('SAT'), 'ACT' => $this->t('ACT')),
'#title' => $this->t('Title'),
];
Example 2:
$options = [];
$options[1] = 'example_url';
$options[2] = 'example_url4';
$options[3] = 'example_url2';
$form['items_selected'] = [
'#type' => 'checkboxes',
'#options' => $options,
'#title' => $this->t('Title'),
];