1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10:
11:
12: namespace App\Lib\Forms\Controls;
13:
14: use Nette\Forms\Controls\RadioList,
15: App\Lib\Forms\Controls\Helpers;
16:
17: class StateRadioList extends RadioList {
18:
19: 20: 21: 22:
23: public function getControl() {
24: $input = \Nette\Forms\Controls\BaseControl::getControl();
25: $items = $this->getItems();
26: $ids = array();
27: if ($this->generateId) {
28: foreach ($items as $value => $label) {
29: $ids[$value] = $input->id . '-' . $value;
30: }
31: }
32:
33: return $this->container->setHtml(
34: Helpers::createStateList(
35: $this->translate($items), array_merge($input->attrs, array(
36: 'id:' => $ids,
37: 'checked?' => $this->value,
38: 'disabled:' => $this->disabled,
39: 'data-nette-rules:' => array(key($items) => $input->attrs['data-nette-rules']),
40: )), array('for:' => $ids) + $this->itemLabel->attrs, $this->separator
41: )
42: );
43: }
44:
45: }
46: