Skip to content

Commit ea3827d

Browse files
committed
CheckboxList: removed itemLabelPrototype
partially reverts 796858f
1 parent 2172ba4 commit ea3827d

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

src/Forms/Controls/CheckboxList.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*
1717
* @property-read Html $separatorPrototype
1818
* @property-read Html $containerPrototype
19-
* @property-read Html $itemLabelPrototype
2019
*/
2120
class CheckboxList extends MultiChoiceControl
2221
{
@@ -26,9 +25,6 @@ class CheckboxList extends MultiChoiceControl
2625
/** @var Html container element template */
2726
protected $container;
2827

29-
/** @var Html item label template */
30-
protected $itemLabel;
31-
3228

3329
/**
3430
* @param string label
@@ -40,7 +36,6 @@ public function __construct($label = NULL, array $items = NULL)
4036
$this->control->type = 'checkbox';
4137
$this->container = Html::el();
4238
$this->separator = Html::el('br');
43-
$this->itemLabel = Html::el();
4439
}
4540

4641

@@ -64,7 +59,7 @@ public function getControl()
6459
'required' => NULL,
6560
'data-nette-rules:' => [key($items) => $input->attrs['data-nette-rules']],
6661
]),
67-
$this->itemLabel->attrs,
62+
$this->label->attrs,
6863
$this->separator
6964
)
7065
);
@@ -128,14 +123,4 @@ public function getContainerPrototype()
128123
return $this->container;
129124
}
130125

131-
132-
/**
133-
* Returns item label HTML element template.
134-
* @return Html
135-
*/
136-
public function getItemLabelPrototype()
137-
{
138-
return $this->itemLabel;
139-
}
140-
141126
}

tests/Forms/Controls.CheckboxList.render.phpt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,3 @@ test(function () { // container prototype
165165

166166
Assert::same('<div><label><input type="checkbox" name="list[]" value="a">b</label></div>', (string) $input->getControl());
167167
});
168-
169-
170-
test(function () { // item label prototype
171-
$form = new Form;
172-
$input = $form->addCheckboxList('list', NULL, [
173-
'a' => 'b',
174-
]);
175-
$input->getItemLabelPrototype()->class('foo');
176-
177-
Assert::same('<label class="foo"><input type="checkbox" name="list[]" value="a">b</label>', (string) $input->getControl());
178-
});

0 commit comments

Comments
 (0)