disabled="disabled" on a checkbox entity field I can't seem to figure out how to make checkbox field on my entity display as disabled in the admin form area. Looked in Drupal 8s "documentation" but couldn't seem to find anything on it.

I tried variations on the code below but nothing seemed to work. Any help is appreciated. Thank you.

$fields['some_field'] = BaseFieldDefinition::create('boolean')
 -&gt;setLabel(t('Some Field'))
 -&gt;setDescription(t('A Field description'))
 -&gt;setReadOnly(TRUE)
 -&gt;setRevisionable(FALSE)
 -&gt;setDefaultValue(FALSE)
 -&gt;setDisplayOptions('form', [
   'type' =&gt; 'boolean_checkbox',
   'attributes' =&gt; array(
    'disabled' =&gt; true,
   ),
   'weight' =&gt; 0,
]);
The BooleanCheckboxWidget has no settings for HTML attributes. You either have to create your own Widget or use hook_field_widget_WIDGET_TYPE_form_alter to add the disabled attribute.

Not tested personally, but you might also take a look at the Read-only Field Widget, could save you some coding: setDisplayOptions('form', ['type' =&gt; 'readonly_field_widget', ...])