How can I disable single option of checkboxes in drupal 8 I am using domain access module in Drupal 8. I want to disable one option/site in domain access settings in node edit page . I am trying to disable through hook_node_form_alter. Following is my array in node form alter

Array
(   

[widget] =&gt; Array
    (
        [#title] =&gt; Domain Access
        [#description] =&gt; stdClass Object
            (
                [__CLASS__] =&gt; Drupal\Core\Field\FieldFilteredMarkup
                [string] =&gt; Select the affiliate domain(s) for this content
            )

        [#field_parents] =&gt; Array
            (
            )

        [#required] =&gt; 1
        [#delta] =&gt; 0
        [#weight] =&gt; 0
        [#element_validate] =&gt; Array
            (
                [0] =&gt; Array
                    (
                        [0] =&gt; Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsButtonsWidget
                        [1] =&gt; validateElement
                    )

            )

        [#key_column] =&gt; target_id
        [#type] =&gt; checkboxes
        [#default_value] =&gt; Array
            (
                [0] =&gt; site1
                [1] =&gt; site3
            )

        [#options] =&gt; Array
            (
                [master] =&gt; stdClass Object
                    (
                        [__CLASS__] =&gt; Drupal\Core\Field\FieldFilteredMarkup
                        [string] =&gt; Master
                    )

                [site1] =&gt; stdClass Object
                    (
                        [__CLASS__] =&gt; Drupal\Core\Field\FieldFilteredMarkup
                        [string] =&gt; Site 1
                    )

                [site2] =&gt; stdClass Object
                    (
                        [__CLASS__] =&gt; Drupal\Core\Field\FieldFilteredMarkup
                        [string] =&gt; Site 2
                    )

                [site3] =&gt; stdClass Object
                    (
                        [__CLASS__] =&gt; Drupal\Core\Field\FieldFilteredMarkup
                        [string] =&gt; Site 3
                    )

                [site4] =&gt; stdClass Object
                    (
                        [__CLASS__] =&gt; Drupal\Core\Field\FieldFilteredMarkup
                        [string] =&gt; Site 4
                    )

            )


)
You can use Form Options Attributes module. 

Then in form alter add below code


  $form['field_domain_access] ['widget'] ['#options_attributes']
  ['your_option_key']  = ['disabled' => 'disabled'] ;