Skip to content

Commit ffb3b6b

Browse files
committed
controls: added option 'type' for distinguishing between them
1 parent fa3fe7f commit ffb3b6b

22 files changed

+45
-0
lines changed

src/Forms/Controls/Button.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function __construct($caption = NULL)
2323
{
2424
parent::__construct($caption);
2525
$this->control->type = 'button';
26+
$this->setOption('type', 'button');
2627
}
2728

2829

src/Forms/Controls/Checkbox.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function __construct($label = NULL)
2727
parent::__construct($label);
2828
$this->control->type = 'checkbox';
2929
$this->wrapper = Nette\Utils\Html::el();
30+
$this->setOption('type', 'checkbox');
3031
}
3132

3233

src/Forms/Controls/CheckboxList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public function __construct($label = NULL, array $items = NULL)
3636
$this->control->type = 'checkbox';
3737
$this->container = Html::el();
3838
$this->separator = Html::el('br');
39+
$this->setOption('type', 'checkbox');
3940
}
4041

4142

src/Forms/Controls/HiddenField.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function __construct($persistentValue = NULL)
2323
{
2424
parent::__construct();
2525
$this->control->type = 'hidden';
26+
$this->setOption('type', 'hidden');
2627
if ($persistentValue !== NULL) {
2728
$this->unmonitor(Nette\Forms\Form::class);
2829
$this->persistValue = TRUE;

src/Forms/Controls/MultiSelectBox.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ class MultiSelectBox extends MultiChoiceControl
1919
private $options = [];
2020

2121

22+
public function __construct($label = NULL, array $items = NULL)
23+
{
24+
parent::__construct($label, $items);
25+
$this->setOption('type', 'select');
26+
}
27+
28+
2229
/**
2330
* Sets options and option groups from which to choose.
2431
* @return self

src/Forms/Controls/RadioList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function __construct($label = NULL, array $items = NULL)
4444
$this->container = Html::el();
4545
$this->separator = Html::el('br');
4646
$this->itemLabel = Html::el();
47+
$this->setOption('type', 'radio');
4748
}
4849

4950

src/Forms/Controls/SelectBox.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ class SelectBox extends ChoiceControl
2525
private $prompt = FALSE;
2626

2727

28+
public function __construct($label = NULL, array $items = NULL)
29+
{
30+
parent::__construct($label, $items);
31+
$this->setOption('type', 'select');
32+
}
33+
34+
2835
/**
2936
* Sets first prompt item in select box.
3037
* @param string

src/Forms/Controls/TextArea.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function __construct($label = NULL)
2323
{
2424
parent::__construct($label);
2525
$this->control->setName('textarea');
26+
$this->setOption('type', 'textarea');
2627
}
2728

2829

src/Forms/Controls/TextInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function __construct($label = NULL, $maxLength = NULL)
2626
parent::__construct($label);
2727
$this->control->type = 'text';
2828
$this->control->maxlength = $maxLength;
29+
$this->setOption('type', 'text');
2930
}
3031

3132

src/Forms/Controls/UploadControl.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function __construct($label = NULL, $multiple = FALSE)
2626
parent::__construct($label);
2727
$this->control->type = 'file';
2828
$this->control->multiple = (bool) $multiple;
29+
$this->setOption('type', 'file');
2930
}
3031

3132

0 commit comments

Comments
 (0)