1818 *
1919 * @property-read Nette\Utils\Html $separatorPrototype
2020 * @property-read Nette\Utils\Html $containerPrototype
21+ * @property-read Nette\Utils\Html $itemLabelPrototype
2122 */
2223class RadioList extends ChoiceControl
2324{
@@ -27,6 +28,9 @@ class RadioList extends ChoiceControl
2728 /** @var Nette\Utils\Html container element template */
2829 protected $ container ;
2930
31+ /** @var Nette\Utils\Html item label template */
32+ protected $ itemLabel ;
33+
3034
3135 /**
3236 * @param string label
@@ -38,6 +42,7 @@ public function __construct($label = NULL, array $items = NULL)
3842 $ this ->control ->type = 'radio ' ;
3943 $ this ->container = Html::el ();
4044 $ this ->separator = Html::el ('br ' );
45+ $ this ->itemLabel = Html::el ();
4146 }
4247
4348
@@ -71,6 +76,16 @@ public function getContainerPrototype()
7176 }
7277
7378
79+ /**
80+ * Returns item label HTML element template.
81+ * @return Nette\Utils\Html
82+ */
83+ public function getItemLabelPrototype ()
84+ {
85+ return $ this ->itemLabel ;
86+ }
87+
88+
7489 /**
7590 * Generates control's HTML element.
7691 * @return Nette\Utils\Html
@@ -97,7 +112,7 @@ public function getControl($key = NULL)
97112 'disabled: ' => $ this ->disabled ,
98113 'data-nette-rules: ' => array (key ($ ids ) => $ input ->attrs ['data-nette-rules ' ]),
99114 )),
100- array ('for: ' => $ ids ),
115+ array ('for: ' => $ ids ) + $ this -> itemLabel -> attrs ,
101116 $ this ->separator
102117 )
103118 );
0 commit comments