File tree 2 files changed +9
-3
lines changed
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
52
52
/** @var bool */
53
53
protected $ disabled = FALSE ;
54
54
55
- /** @var bool */
56
- private $ omitted = FALSE ;
55
+ /** @var bool|NULL */
56
+ private $ omitted ;
57
57
58
58
/** @var Nette\Forms\Rules */
59
59
private $ rules ;
@@ -225,7 +225,7 @@ public function setOmitted($value = TRUE)
225
225
*/
226
226
public function isOmitted ()
227
227
{
228
- return $ this ->omitted || $ this ->disabled ;
228
+ return $ this ->omitted || ( $ this ->disabled && $ this -> omitted === NULL ) ;
229
229
}
230
230
231
231
Original file line number Diff line number Diff line change 6
6
7
7
use Nette \Forms \Form ;
8
8
use Nette \Utils \ArrayHash ;
9
+ use Nette \Forms \Controls \TextInput ;
9
10
use Tester \Assert ;
10
11
11
12
@@ -19,3 +20,8 @@ $form->addText('omittedInput')
19
20
->setOmitted ();
20
21
21
22
Assert::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