File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ abstract class BaseControl extends Nette\ComponentModel\Component implements ICo
5252 /** @var bool */
5353 protected $ disabled = FALSE ;
5454
55- /** @var bool */
56- private $ omitted = FALSE ;
55+ /** @var bool|NULL */
56+ private $ omitted ;
5757
5858 /** @var Nette\Forms\Rules */
5959 private $ rules ;
@@ -225,7 +225,7 @@ public function setOmitted($value = TRUE)
225225 */
226226 public function isOmitted ()
227227 {
228- return $ this ->omitted || $ this ->disabled ;
228+ return $ this ->omitted || ( $ this ->disabled && $ this -> omitted === NULL ) ;
229229 }
230230
231231
Original file line number Diff line number Diff line change 66
77use Nette \Forms \Form ;
88use Nette \Utils \ArrayHash ;
9+ use Nette \Forms \Controls \TextInput ;
910use Tester \Assert ;
1011
1112
@@ -19,3 +20,8 @@ $form->addText('omittedInput')
1920 ->setOmitted ();
2021
2122Assert::same (['input ' => '' ], $ form ->getValues (TRUE ));
23+
24+
25+ Assert::true ((new TextInput )->setDisabled ()->isOmitted ());
26+ Assert::false ((new TextInput )->setDisabled ()->setDisabled (FALSE )->isOmitted ());
27+ Assert::false ((new TextInput )->setDisabled ()->setOmitted (FALSE )->isOmitted ());
You can’t perform that action at this time.
0 commit comments