How do I make a checkbox form initially have all options checked? I have a drupal form in a module that doesn't pull in information until submitted.  Can I make the checkboxes initially checked?
  $form['search_block_type'] = array(
    '#description' =&gt; &quot;Select content types&quot;,
    '#type' =&gt; 'checkboxes',
    '#options' =&gt; $options,
    '#title' =&gt; t('Content types'),
    '#default_value' =&gt; $default_types,
  );

I assumed it was #checked' =&gt; 'yes' but that doesn't seem to work.(from a view)
The actual form element values when selected are always the keys of what you have inside $options. You also can see that when inspecting the markup. So simply use '#default_value' =&gt; array_keys($options) to have all options preselected.
$form['search_block_type'] = [
  '#type' =&gt; 'checkboxes',
  '#title' =&gt; t('Content types'),
  '#description' =&gt; t('Select content types'),
  '#options' =&gt; $options,
  '#default_value' =&gt; array_keys($options),
];