@@ -46,9 +46,7 @@ public function loadHttpData(): void
4646 ? $ this ->getHttpData (Nette \Forms \Form::DataText)
4747 : explode (', ' , $ data );
4848 $ this ->value = array_keys (array_flip ($ data ));
49- if (is_array ($ this ->disabled )) {
50- $ this ->value = array_diff ($ this ->value , array_keys ($ this ->disabled ));
51- }
49+ $ this ->value = array_diff ($ this ->value , array_keys ($ this ->disabledItems ));
5250 }
5351
5452
@@ -62,7 +60,7 @@ public function getControl(): Html
6260 array_merge ($ input ->attrs , [
6361 'id ' => null ,
6462 'checked? ' => $ this ->value ,
65- 'disabled: ' => $ this ->disabled ,
63+ 'disabled: ' => $ this ->disabled ?: $ this -> disabledItems ,
6664 'required ' => null ,
6765 'data-nette-rules: ' => [array_key_first ($ items ) => $ input ->attrs ['data-nette-rules ' ]],
6866 ]),
@@ -85,7 +83,7 @@ public function getControlPart($key = null): Html
8583 return parent ::getControl ()->addAttributes ([
8684 'id ' => $ this ->getHtmlId () . '- ' . $ key ,
8785 'checked ' => in_array ($ key , (array ) $ this ->value , strict: true ),
88- 'disabled ' => is_array ( $ this ->disabled ) ? isset ($ this ->disabled [$ key ]) : $ this -> disabled ,
86+ 'disabled ' => $ this ->disabled || isset ($ this ->disabledItems [$ key ]),
8987 'required ' => null ,
9088 'value ' => $ key ,
9189 ]);
0 commit comments