Where can you change the #type of a checkbox? I have content type with a taxonomy attached to it (since it is Drupal 8, it ends up being an Entity Reference field).  The form is configured to render out this field input as checkboxes.

I have run into a situation where I need to change some of the checkboxes into plain text when the form is rendered (node create, note edit etc).  I tried to push a #process function onto the field,

function MYMODULE_form_node_job_form_alter(&amp;$form, FormStateInterface $form_state, $form_id) {
  $form['field_foo']['widget']['#process'][] = 'MYMODULE_foo';
}

function MYMODULE_foo(&amp;$element, FormStateInterface $form_state, &amp;$complete_form) {
  // do stuff
}


but when I inspect the $element with XDebug, the #options haven't been processed yet.

So, where in the form / render pipeline can this be changed?
Beside preprocess you can add code to the rendering of form elements in #pre_render, #theme, #theme_wrappers and #post_render. Part of the rendering pipeline of checkboxes is for example CompositeFormElementTrait::preRenderCompositeFormElement:

  public static function preRenderCompositeFormElement($element) {
    // Set the element's title attribute to show #title as a tooltip, if needed.
    if (isset($element['#title']) &amp;&amp; $element['#title_display'] == 'attribute') {
      $element['#attributes']['title'] = $element['#title'];
      if (!empty($element['#required'])) {
        // Append an indication that this field is required.
        $element['#attributes']['title'] .= ' (' . t('Required') . ')';
      }
    }

    if (isset($element['#title']) || isset($element['#description'])) {
      // @see #type 'fieldgroup'
      $element['#attributes']['id'] = $element['#id'] . '--wrapper';
      $element['#theme_wrappers'][] = 'fieldset';
      $element['#attributes']['class'][] = 'fieldgroup';
      $element['#attributes']['class'][] = 'form-composite';
    }
    return $element;